Foros del Web » Programando para Internet » Javascript »

Interesante! Menu con el mouse!!

Estas en el tema de Interesante! Menu con el mouse!! en el foro de Javascript en Foros del Web. Hola, les paso este JS no se si es viejo pero esta padre lo vi en una pagina, en lugar de anular boton derecho mejor ...
  #1 (permalink)  
Antiguo 14/03/2002, 17:28
Avatar de Alvariux
Usuario no validado
 
Fecha de Ingreso: noviembre-2001
Ubicación: Yucatán México
Mensajes: 499
Antigüedad: 22 años, 5 meses
Puntos: 0
Interesante! Menu con el mouse!!

Hola, les paso este JS no se si es viejo pero esta padre lo vi en una pagina, en lugar de anular boton derecho mejor darle unso poniendo un menu o no??

codigo: siguiente mensaje
  #2 (permalink)  
Antiguo 14/03/2002, 17:29
Avatar de Alvariux
Usuario no validado
 
Fecha de Ingreso: noviembre-2001
Ubicación: Yucatán México
Mensajes: 499
Antigüedad: 22 años, 5 meses
Puntos: 0
Re: Interesante! Menu con el mouse!!


entre las etiquetas body y /body:



<style>
<!--
.skin0 {
position:absolute;
text-align:left;
width:200px;
border:2px solid black;
background-color:menu;
font-family:Verdana;
line-height:20px;
cursor:default;
visibility:hidden;
}
.skin1 {
cursor:default;
font:menutext;
position:absolute;
text-align:left;
font-family: Arial, Helvetica, sans-serif;
font-size: 10pt;
width:120px;
background-color:menu;
border:1 solid buttonface;
visibility:hidden;
border:2 outset buttonhighlight;
}
.menuitems {
padding-left:15px;
padding-right:10px;
}
-->
</style>

<SCRIPT LANGUAGE="JavaScript1.2">
<!-- Web Site: http://www.dynamicdrive.com -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
var menuskin = "skin1"; // skin0, or skin1
var display_url = 0; // Show URLs in status bar?
function showmenuie5() {
var rightedge = document.body.clientWidth-event.clientX;
var bottomedge = document.body.clientHeight-event.clientY;
if (rightedge < ie5menu.offsetWidth)
ie5menu.style.left = document.body.scrollLeft + event.clientX - ie5menu.offsetWidth;
else
ie5menu.style.left = document.body.scrollLeft + event.clientX;
if (bottomedge < ie5menu.offsetHeight)
ie5menu.style.top = document.body.scrollTop + event.clientY - ie5menu.offsetHeight;
else
ie5menu.style.top = document.body.scrollTop + event.clientY;
ie5menu.style.visibility = "visible";
return false;
}
function hidemenuie5() {
ie5menu.style.visibility = "hidden";
}
function highlightie5() {
if (event.srcElement.className == "menuitems") {
event.srcElement.style.backgroundColor = "highlight";
event.srcElement.style.color = "white";
if (display_url)
window.status = event.srcElement.url;
}
}
function lowlightie5() {
if (event.srcElement.className == "menuitems") {
event.srcElement.style.backgroundColor = "";
event.srcElement.style.color = "black";
window.status = "";
}
}
  #3 (permalink)  
Antiguo 14/03/2002, 17:30
Avatar de Alvariux
Usuario no validado
 
Fecha de Ingreso: noviembre-2001
Ubicación: Yucatán México
Mensajes: 499
Antigüedad: 22 años, 5 meses
Puntos: 0
Re: Interesante! Menu con el mouse!!

function jumptoie5() {
if (event.srcElement.className == "menuitems") {
if (event.srcElement.getAttribute("target") != null)
window.open(event.srcElement.url, event.srcElement.getAttribute("target")) ;
else
window.location = event.srcElement.url;
}
}
// End -->
</script>


entre las etiquetas body y /body personalizando los links:



div id="ie5menu" class="skin0" onMouseover="highlightie5()" onMouseout="lowlightie5()" onClick="jumptoie5();">
<div class="menuitems" url="javascript:history.back();">Go Back</div>
<div class="menuitems" url="http://javascript.internet.com">Go Home</div>
<hr>
<div class="menuitems" url="http://forum.javascriptsource.com">JS Forum</div>
<div class="menuitems" url="http://faq.javascriptsource.com">Site FAQs</div>
<hr>
<div class="menuitems" url="http://javascript.internet.com/link-us.html">Link to Us</div>
<div class="menuitems" url="http://javascript.internet.com/feedback.html">Contact Us</div>
</div>
<script language="JavaScript1.2">
if (document.all && window.print) {
ie5menu.className = menuskin;
document.oncontextmenu = showmenuie5;
document.body.onclick = hidemenuie5;
}
</script>




Espero le sirva a alguien
Saludos

<embed width="200HEIGHT=50" height="50" quality="high" bgcolor="#ffffff" src="http://www.geocities.com/aglezt/alvaro.swf"></embed>
  #4 (permalink)  
Antiguo 14/03/2002, 23:22
asound
Invitado
 
Mensajes: n/a
Puntos:
Re: Interesante! Menu con el mouse!!

excelente menu, gracias por compartirlo con nosotros...
  #5 (permalink)  
Antiguo 15/03/2002, 11:10
 
Fecha de Ingreso: enero-2002
Mensajes: 86
Antigüedad: 22 años, 3 meses
Puntos: 0
Re: Interesante! Menu con el mouse!!

Hola alvariux
Gracias por el scrip, original y practico, solo creo que cabe una aclaracion, en la primera parte en donde colocar dice body /body, deberia decir head /head, puede ser?, ya que asi funciona mejor en la carga del menu.
Saludos, Magna
  #6 (permalink)  
Antiguo 15/03/2002, 17:34
Avatar de Alvariux
Usuario no validado
 
Fecha de Ingreso: noviembre-2001
Ubicación: Yucatán México
Mensajes: 499
Antigüedad: 22 años, 5 meses
Puntos: 0
Re: Interesante! Menu con el mouse!!

asi es magna es entre el head y head

Gracias por corregirlo
  #7 (permalink)  
Antiguo 16/03/2002, 10:06
 
Fecha de Ingreso: diciembre-2001
Mensajes: 45
Antigüedad: 22 años, 4 meses
Puntos: 0
Re: Interesante! Menu con el mouse!!

¡Hola!

¡Dos por el precio de Unooo!!!

dado que la aportacion del amigo ALVARIUX les has agradado, aqui les empalmo con otra version adicional.

En verdad me parecen aunque algo más trabajoso colocar en las paginas, más esteticos y sobre todo de &quot;Utilidad&quot;, comparado con esos &quot;frios y arrogantes&quot; anuladores de boton derecho de mouse.

Es mi modesta opinion.

Asi que....¡ Aprovechen &quot;2 X el precio de 1&quot;...!!!

  #8 (permalink)  
Antiguo 16/03/2002, 10:07
 
Fecha de Ingreso: diciembre-2001
Mensajes: 45
Antigüedad: 22 años, 4 meses
Puntos: 0
Re: Interesante! Menu con el mouse!!

COLOCAR TODO EL SCRIPT DENTRO DE &lt;HEAD&gt; y &lt;/HEAD&gt;

&lt;script language=&quot;javaScript&quot;&gt;
&lt;!--

///////////////////////////////////////////////////////////////////////////////
// ..:: realMenu v1.27 ::..
// copyright © jordan neill 2000
// Script featured on Website Abstraction (http://wsabstract.com)
//
// change the menuItems array with your options and set the urls to link to
// use addMenuItem(&quot;Text to show&quot;, &quot;Url To Link To&quot;); to make an item
// use addMenuItem(&quot;Text&quot;, Url&quot;, &quot;Img To Show&quot;); to make an item with an image
// use addMenuItem(); to indicate a separator bar
// you can use html tags in the text, eg, &lt;i&gt;, &lt;b&gt; or &lt;u&gt;
//
// images used should be 16x16 transparent gifs
///////////////////////////////////////////////////////////////////////////////

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 = 8; //speed which menu appears (lower=faster)
menuOffset = 2; //offset of menu from mouse pointer

addMenuItem(&quot;&lt;center&gt;RealMenu v1.27&lt;/center&gt;&quot;,&quot;http://wsabstract.com/script/script2/realmenu.shtml&quot;);
addMenuItem();
addMenuItem(&quot;Website Abstraction&quot;,&quot;http://wsabstract.com&quot;);
addMenuItem(&quot;Dynamic Drive&quot;,&quot;http://www.dynamicdrive.com&quot;);
addMenuItem(&quot;Freewarejava.com&quot;,&quot;htt p://freewarejava.com&quot;);
addMenuItem();
addMenuItem(&quot;CNN&quot;,&quot;http://www.cnn.com&quot;);
addMenuItem(&quot;ABC News&quot;,&quot;http://www.abcnews.com&quot;);
addMenuItem(&quot;MSNBC&quot;,&quot;http://www.msnbc.com&quot;);
addMenuItem(&quot;BBC News&quot;,&quot;http://news.bbc.co.uk&quot;);
addMenuItem(&quot;CBS News&quot;,&quot;http://www.cbsnews.com&quot;);

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


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

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

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(&quot;openMenu(0,0)&quot;, menuDelay);

return false;
}


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

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

if(iHeight &lt; menuHeight)
menuTimer = setTimeout(&quot;openMenu(iHeight + menuYIncrement, iWidth + menuXIncrement)&quot;, 1);
else
clearTimeout(menuTimer);
}


if(isIe) document.oncontextmenu = showMenu;


//--&gt;
&lt;/script&gt;
  #9 (permalink)  
Antiguo 16/03/2002, 10:09
 
Fecha de Ingreso: diciembre-2001
Mensajes: 45
Antigüedad: 22 años, 4 meses
Puntos: 0
Re: Interesante! Menu con el mouse!!

PD. Si observan con cuidado, tambiem pueden incluir pequeñas imagenes adjuntas en el menu. :P
  #10 (permalink)  
Antiguo 18/03/2002, 14:25
 
Fecha de Ingreso: enero-2002
Mensajes: 86
Antigüedad: 22 años, 3 meses
Puntos: 0
Re: Interesante! Menu con el mouse!!

Alvaruix....por nada ;)

Dekasegi, se supone que el scrip funciona con el click derecho?.... lo voy a seguir mirando, pero en principio, asi como esta no me funciono....


  #11 (permalink)  
Antiguo 19/03/2002, 11:24
Avatar de adex  
Fecha de Ingreso: marzo-2002
Ubicación: Lima, Perú, América Latina
Mensajes: 445
Antigüedad: 22 años, 1 mes
Puntos: 0
Re: Interesante! Menu con el mouse!!

Tengo una JS que no te permite utilizar el Click Izq. y Der. por lo cual te sale un menu desplegable, la encontre en una Web... si los interesa pasen la voz...
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:59.