[RightclickMenu]

Contents

Visit NightfireNET
Visit One Project

Bauen Sie sich Ihr eigenes Kontextmenu, welches beim Klicken mit der rechten Maustaste aktiv wird.
Die Funktionsfähigkeit bei Mozilla- Browsern hängt von den individuellen Browser- Einstellungen ab (dom.event.contextmenu.enabled : true/false)

[zwischen <HEAD> und </HEAD>]

<STYLE>
#contextMenu { position: absolute;
visibility: hidden;
width: 120px;
background-color: lightgrey;
layer-background-color: lightgrey;
border: 2px outset white;
}
A.Menu { color: black;
text-decoration: none;
cursor: default;
width: 100%
}

A.MenuOn { color: white;
text-decoration: none;
background-color: darkblue;
cursor: default;
width: 100%
}
</STYLE>

<SCRIPT>
<!-- Begin
var menu;
//Browser Sniffer
var ns4up = (document.layers) ? 1 : 0;
var ie4up = (document.all) ? 1 : 0;
var mozup = (!document.all && document.getElementById) ? 1 : 0;

function showMenu (evt) {
if (ie4up) {
document.all.contextMenu.style.pixelLeft = event.clientX;
document.all.contextMenu.style.pixelTop = document.body.scrollTop+event.clientY;
document.all.contextMenu.style.visibility = 'visible';
return false;
}
if (ns4up) {
if (evt.which == 3) {
document.contextMenu.left = evt.x;
document.contextMenu.top = evt.y;
document.contextMenu.onmouseout =
function (evt) {
this.visibility = 'hide';
}
document.contextMenu.visibility = 'show';
return false;
}
}
if (mozup) {
document.getElementById("contextMenu").style.left = evt.pageX;
document.getElementById("contextMenu").style.top = evt.pageY;
document.getElementById("contextMenu").style.visibility = 'visible';
return false;
}
//return true;
}

if (ie4up||mozup) {
document.oncontextmenu =showMenu;
}
if (ns4up) {
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown = showMenu;
}

// End -->
</SCRIPT>

[zwischen <BODY> und </BODY>]

<DIV ID="contextMenu"
     ONMOUSEOUT="menu = this; this.tid = setTimeout
('menu.style.visibility = \'hidden\'', 20);"
     ONMOUSEOVER="clearTimeout(this.tid);"
>
<A HREF="http://nirvana.media3.net";
CLASS="Menu"
   ONMOUSEOVER="this.className = 'MenuOn'"
   ONMOUSEOUT="this.className = 'Menu';"
>
Visit Nirvana
</A>
<BR>
<A HREF="http://oneproject.net"; CLASS="Menu"
   ONMOUSEOVER="this.className = 'MenuOn'"
   ONMOUSEOUT="this.className = 'Menu';"
>
Visit One Project
</A>
</DIV>

[Autor]

??

[Download]

Kopieren Sie bitte den Code

Copyright © 1998- Nightfire Webworker Archiv Script No: 0224