Foros del Web » Programando para Internet » Javascript »

Como C Cambia??

Estas en el tema de Como C Cambia?? en el foro de Javascript en Foros del Web. Saludos! Encontre este codigo k cuando c da un click derecho sale un menu........... pero yo kiero k salga el menu cuando le d un ...
  #1 (permalink)  
Antiguo 03/02/2003, 21:28
 
Fecha de Ingreso: diciembre-2002
Ubicación: --
Mensajes: 119
Antigüedad: 21 años, 4 meses
Puntos: 0
Pregunta Como C Cambia??

Saludos!

Encontre este codigo k cuando c da un click derecho sale un menu........... pero yo kiero k salga el menu cuando le d un click izq. y no encuentro como cambiarlo......... aki esta el codigo...................................

kien me pueda ayudar Gracias!!!

CODIGO:


<script language="javaScript">

menuItems = new Array();
menuItemNum = 0;

function addMenuItem(text, url, img){
if(img) menuItems[menuItemNum] = new Array(text, url, img);
else if(text) menuItems[menuItemNum] = new Array(text, url);
else menuItems[menuItemNum] = new Array();
menuItemNum++;
}

menuWidth = 148; //menu width
menuHeight = 176; //menu height
menuDelay = 50; //delay before menu appears
menuSpeed = 4; //speed which menu appears (lower=faster)
menuOffset = 2; //offset of menu from mouse pointer

addMenuItem("<center>Inicio</center>","http://");
addMenuItem();
addMenuItem("blablabla","http://");
addMenuItem("blablabla","http://");
addMenuItem("blablabla","http://");
addMenuItem();
addMenuItem("Favorito","http://www.cnn.com");
addMenuItem("ABC News","http://www.abcnews.com");
addMenuItem("MSNBC","http://www.msnbc.com");
addMenuItem("BBC News","http://news.bbc.co.uk");
addMenuItem("CBS News","http://www.cbsnews.com");

///////////////////////////////////////////////////////////////////////////////
// do not edit the code below, it is required for the menu to work correctly
///////////////////////////////////////////////////////////////////////////////


if(window.navigator.appName == "Microsoft Internet Explorer" && window.navigator.appVersion.substring(window.navig ator.appVersion.indexOf("MSIE") + 5, window.navigator.appVersion.indexOf("MSIE") + 8) >= 5.5)
isIe = 1;
else
isIe = 0;

if(isIe){
menuContent = '<table id="rightMenu" width="0" height="0" cellspacing="0" cellpadding="0" style="font:menu;color:menutext;"><tr height="1"><td style="background:threedlightshadow" colspan="4"></td><td style="background:threeddarkshadow"></td></tr><tr height="1"><td style="background:threedlightshadow"></td><td style="background:threedhighlight" colspan="2"></td><td style="background:threedshadow"></td><td style="background:threeddarkshadow"></td></tr><tr height="10"><td style="background:threedlightshadow"></td><td style="background:threedhighlight"></td><td style="background:threedface"><table cellspacing="0" cellpadding="0" nowrap style="font:menu;color:menutext;cursor:default;">' ;
for(m=0;m<menuItems.length;m++){
if(menuItems[m][0] && menuItems[m][2])
menuContent += '<tr height="17" onMouseOver="this.style.background=\'highlight\';t his.style.color=\'highlighttext\';" onMouseOut="this.style.background=\'threedface\';t his.style.color=\'menutext\';" onClick="parent.window.location.href=\'' + menuItems[m][1] + '\'"><td style="background:threedface" width="1" nowrap></td><td width="21" nowrap><img src="' + menuItems[m][2] + '"></td><td nowrap>' + menuItems[m][0] + '</td><td width="21" nowrap></td><td style="background:threedface" width="1" nowrap></td></tr>';
else if(menuItems[m][0])
menuContent += '<tr height="17" onMouseOver="this.style.background=\'highlight\';t his.style.color=\'highlighttext\';" onMouseOut="this.style.background=\'threedface\';t his.style.color=\'menutext\';" onClick="parent.window.location.href=\'' + menuItems[m][1] + '\'"><td style="background:threedface" width="1" nowrap></td><td width="21" nowrap></td><td nowrap>' + menuItems[m][0] + '</td><td width="21" nowrap></td><td style="background:threedface" width="1" nowrap></td></tr>';
else
menuContent += '<tr><td colspan="5" height="4"></td></tr><tr><td colspan="5"><table cellspacing="0"><tr><td width="2" height="1"></td><td width="0" height="1" style="background:threedshadow"></td><td width="2" height="1"></td></tr><tr><td width="2" height="1"></td><td width="100%" height="1" style="background:threedhighlight"></td><td width="2" height="1"></td></tr></table></td></tr><tr><td colspan="5" height="3"></td></tr>';
}
menuContent += '</table></td><td style="background:threedshadow"></td><td style="background:threeddarkshadow"></td></tr><tr height="1"><td style="background:threedlightshadow"></td><td style="background:threedhighlight"></td><td style="background:threedface"></td><td style="background:threedshadow"></td><td style="background:threeddarkshadow"></td></tr><tr height="1"><td style="background:threedlightshadow"></td><td style="background:threedshadow" colspan="3"></td><td style="background:threeddarkshadow"></td></tr><tr height="1"><td style="background:threeddarkshadow" colspan="5"></td></tr></table>';

menuPopup = window.createPopup();
menuPopup.document.body.innerHTML = menuContent;
}

function showMenu(){
menuXPos = event.clientX + menuOffset;
menuYPos = event.clientY + menuOffset;

menuXIncrement = menuWidth / menuSpeed;
menuYIncrement = menuHeight / menuSpeed;

menuTimer = setTimeout("openMenu(0,0)", menuDelay);

return false;
}


function openMenu(height, width){
iHeight = height;
iWidth = width;

menuPopup.show(menuXPos, menuYPos, iWidth, iHeight, document.body);

if(iHeight < menuHeight)
menuTimer = setTimeout("openMenu(iHeight + menuYIncrement, iWidth + menuXIncrement)", 1);
else
clearTimeout(menuTimer);
}


if(isIe) document.oncontextmenu = showMenu;


//-->
</script>
  #2 (permalink)  
Antiguo 04/02/2003, 10:19
Avatar de caricatos
Moderador
 
Fecha de Ingreso: abril-2002
Ubicación: Torremolinos (Málaga)
Mensajes: 19.607
Antigüedad: 22 años
Puntos: 1284
Hola donquinto:

Perdona, pero no leí más que las primeras líneas de tu mensaje, cuando dices que funciona con un botón del ratón...

Creo que funciona en el evento del body oncontextmenu (o algo así) y debería funcionar con el evento onclick...

<body onclick="bá, bla..."

Espero que te sirva
  #3 (permalink)  
Antiguo 04/02/2003, 10:49
 
Fecha de Ingreso: diciembre-2002
Ubicación: --
Mensajes: 119
Antigüedad: 21 años, 4 meses
Puntos: 0
si funciona onclick.......pero con el click derecho...........y yo kiero k sea con el click Izq.
  #4 (permalink)  
Antiguo 04/02/2003, 13:07
Avatar de caricatos
Moderador
 
Fecha de Ingreso: abril-2002
Ubicación: Torremolinos (Málaga)
Mensajes: 19.607
Antigüedad: 22 años
Puntos: 1284
Hola donquinto:

Estamos hablando de lo mismo:

Cambia la línea que está al final:

if(isIe) document.oncontextmenu = showMenu;

if (isle) document.body.onclick = showMenu;

// También puede funcionar en otros navegadores, osea que también puedes probar sin "if (isle)"

Saludos
  #5 (permalink)  
Antiguo 05/02/2003, 13:12
 
Fecha de Ingreso: diciembre-2002
Ubicación: --
Mensajes: 119
Antigüedad: 21 años, 4 meses
Puntos: 0
OOOOOoooooooooooooooooooo


claro claro...... pero tiene un fallo..........no es


if (isle) document.body.onclick = showMenu;

............ es ..................

if (isle) document.onclick = showMenu;


Gracia !!
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 07:52.