Foros del Web » Programando para Internet » Javascript »

Script para botón derecho de ratón.. ayuda..

Estas en el tema de Script para botón derecho de ratón.. ayuda.. en el foro de Javascript en Foros del Web. buenas... akí os pongo un script k copié hace tiempo y k no me va.... Debería salir un menú desplegable con links al darle al ...
  #1 (permalink)  
Antiguo 06/07/2002, 05:29
Avatar de oskitar  
Fecha de Ingreso: junio-2002
Mensajes: 245
Antigüedad: 21 años, 10 meses
Puntos: 1
Script para botón derecho de ratón.. ayuda..

buenas... akí os pongo un script k copié hace tiempo y k no me va....

Debería salir un menú desplegable con links al darle al botón derecho del ratón.... os lo pongo para ver si sacais el error...

http://www.camporio.com/botonderecho.html


gracias a todos
  #2 (permalink)  
Antiguo 06/07/2002, 06:30
Avatar de CORE
Usuario no validado
 
Fecha de Ingreso: abril-2002
Ubicación: Merida
Mensajes: 2.165
Antigüedad: 22 años
Puntos: 3
Re: Script para botón derecho de ratón.. ayuda..

<script language=JavaScript>
<!-- // RightClickMenu

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.cl ientY-ie5menu.offsetHeight
else
ie5menu.style.top=document.body.scrollTop+event.cl ientY
ie5menu.style.visibility="visible"
return false
}
function hidemenuie5(){
ie5menu.style.visibility="hidden"
}
function highlightie5(){
if (event.srcElement.className=="menuitems" ){
event.srcElement.style.backgroundColor="#6633 66"
event.srcElement.style.color="white"
}

sigue-->>
  #3 (permalink)  
Antiguo 06/07/2002, 06:31
Avatar de CORE
Usuario no validado
 
Fecha de Ingreso: abril-2002
Ubicación: Merida
Mensajes: 2.165
Antigüedad: 22 años
Puntos: 3
Re: Script para botón derecho de ratón.. ayuda..

}
function lowlightie5(){
if (event.srcElement.className=="menuitems" ){
event.srcElement.style.backgroundColor="&quot ;
event.srcElement.style.color="#ffffff"
}
}
function jumptoie5(){
if (event.srcElement.className=="menuitems" ){
if (event.srcElement.url != ''){
if (event.srcElement.getAttribute("target") !=null)
window.open(event.srcElement.url,event.srcElement. getAttribute("target"))
else
window.location=event.srcElement.url
}
}
}
// -->
</script>
<style type=text/css>.cMenu {
BORDER-RIGHT: #30384f 2px solid; BORDER-TOP: #003366 2px solid; FONT-WEIGHT: normal; FONT-SIZE: 8pt; VISIBILITY: hidden; BORDER-LEFT: #30384f 2px solid; WIDTH: 100px; CURSOR: default; COLOR: #CCCCCC; LINE-HEIGHT: 18px; BORDER-BOTTOM: #30384f 4px solid; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif; POSITION: absolute; BACKGROUND-COLOR: #0066CC
}
.menuitems {
PADDING-RIGHT: 5px; PADDING-LEFT: 5px
}
</style>
<rightclick>
<!--[if IE]>
<DIV class=cMenu id=ie5menu onmouseover=highlightie5()
onclick=jumptoie5() onmouseout=lowlightie5() align=left>
<DIV class=menuitems url="index.php">Scripts</DIV>
<DIV class=menuitems url="archivos.php">Archivos</DIV>
<DIV class=menuitems url="buscador.php">Buscador</DIV>
<HR color=#000000 SIZE=1>
</DIV><![endif]-->
<script language=JavaScript>
<!--
if (document.all&&window.print){
ie5menu.className="cMenu"
document.oncontextmenu=showmenuie5
document.body.onclick=hidemenuie5
}
//-->
</script>
<script language=JavaScript>
<!--
if (document.all&&window.print){
ie5menu.className="cMenu"
document.oncontextmenu=showmenuie5
document.body.onclick=hidemenuie5
}
//-->
</script>

otro
  #4 (permalink)  
Antiguo 06/07/2002, 06:32
Avatar de CORE
Usuario no validado
 
Fecha de Ingreso: abril-2002
Ubicación: Merida
Mensajes: 2.165
Antigüedad: 22 años
Puntos: 3
Re: Script para botón derecho de ratón.. ayuda..

<script language=JavaScript>
<!--
//Esto es el grueso del script
/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.cl ientY-ie5menu.offsetHeight
else
ie5menu.style.top=document.body.scrollTop+event.cl ientY
ie5menu.style.visibility="visible"
return false
}
function hidemenuie5(){
ie5menu.style.visibility="hidden"
}
function highlightie5(){
if (event.srcElement.className=="menuitems" ){
event.srcElement.style.backgroundColor="#0066 66" //Modificable entre " "
event.srcElement.style.color="#ffffff" //Modificable entre " "
}
}
function lowlightie5(){
if (event.srcElement.className=="menuitems" ){
event.srcElement.style.backgroundColor="&quot ;
event.srcElement.style.color="#ffffff" //Modificable entre " "
}
}
function jumptoie5(){
if (event.srcElement.className=="menuitems" ){
if (event.srcElement.url != ''){
if (event.srcElement.getAttribute("target") !=null)
window.open(event.srcElement.url,event.srcElement. getAttribute("target"))
else
window.location=event.srcElement.url
}
}
}
// -->
</script>
// Ahora entramos en la pura configuración...
//A continuación la configuración principal del menu
<style type=text/css>.cMenu {
BACKGROUND-COLOR: #006CAA; BORDER-BOTTOM: #000000 2px solid; BORDER-LEFT: #000000 2px solid; BORDER-RIGHT: #000000 2px solid; BORDER-TOP: #000000 2px solid; COLOR: #00000; CURSOR: default; FONT-FAMILY: Verdana; FONT-SIZE: 8pt; FONT-WEIGHT: normal; LINE-HEIGHT: 14px; POSITION: absolute; VISIBILITY: hidden; WIDTH: 100px
}
sigue -->
  #5 (permalink)  
Antiguo 06/07/2002, 06:34
Avatar de CORE
Usuario no validado
 
Fecha de Ingreso: abril-2002
Ubicación: Merida
Mensajes: 2.165
Antigüedad: 22 años
Puntos: 3
Re: Script para botón derecho de ratón.. ayuda..

PADDING-LEFT: 5px; PADDING-RIGHT: 5px
}
</style>
<rightclick> </rightclick></font><font face="verdana" size="1" color="#FFFFFF"></font><font color="#CCCCCC"><rightclick>
<!--[if IE]>
<DIV align=left class=cMenu id=ie5menu onclick=jumptoie5()
onmouseout=lowlightie5() onmouseover=highlightie5()>
<DIV class=menuitems url="http://www.dominio.com/link.php">SITIO</DIV>
<HR color=#000000 SIZE=1>
<DIV class=menuitems url="http://www.dominio.com/link.php">Sección 1</DIV>
<DIV class=menuitems url="http://www.dominio.com/link.php">Sección 2</DIV>
<DIV class=menuitems url="http://www.dominio.com/link.php">Sección 3</DIV>
<DIV class=menuitems url="http://www.dominio.com/link.php">Sección 4</DIV>
<DIV class=menuitems url="http://www.dominio.com/link.php">Sección 5</DIV>
</DIV><![endif]-->
<script language=JavaScript>
<!--
if (document.all&&window.print){
ie5menu.className="cMenu"
document.oncontextmenu=showmenuie5
document.body.onclick=hidemenuie5
}
//-->
</script>
<noscript> </noscript></rightclick></font></font></span></font>
<!--FIN -->


Y ya a ver cual te sirve Te aconsejo que te bajes el Scriptmaster de <a href='ir.asp?http://
http://www.webtutorial.com.ar' target='_blank'>
http://www.webtutorial.com.ar...</a>
vienen muchisimos codigos para tu web
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 11:27.