Hi,
Following is the code that i have written for disabling the default
right click menu and poping up my own menu.
It works fine in netscape 6.0 and IE but not in netscape 7.0 Can u
please help in solving this problem. Thanks, shashi.
<html>
<head>
<style>
#contextMenu {
position: absolute;
visibility: hidden;
width: 120px;
background-color: lightgrey;
border: 2px outset white;
}
A.menu { color: black; text-decoration: none;
cursor: default; width: 100%;}
A.menuOn { color: white;
background-color: darkblue; text-decoration: none;
cursor: default; width: 100%; }
</STYLE>
<script>
var menu;
function showMenu (evt) {
alert(" entered showMane");
if (document.all) {
//alert(evt.cancelable);
//alert("this should not come up");
document.all.contextMenu.style.pixelLeft = event.clientX;
document.all.contextMenu.style.pixelTop = event.clientY;
document.all.contextMenu.style.visibility = 'visible';
return false;
}
else if (document.getElementById) {
if (evt.which == 3) {
//alert("in netscape");
//alert(evt.cancelable);
// alert( evt.preventDefault());
evt.preventDefault();
var menu = document.getElementById('contextMenu');
menu.style.left = evt.pageX + 'px';
menu.style.top = evt.pageY + 'px';
menu.style.visibility = 'visible';
return false;
evt.stopPropagation;
}
}
return true;
}
if (document.all)
document.oncontextmenu
showMenu;
if (!document.all && document.getElementById)
{
document.onmouseup = showMenu;
document.onmousedown = showMenu;
}
</SCRIPT>
</head>
<body>
<div ID="contextMenu" ONMOUSEOUT=" this.style.visibility
'hidden'"
ONMOUSEOVER="this.style.visibility = 'visible'">
<a HREF="modify.html" CLASS="menu"
>
shashi
</a>
<br>
<a HREF="return.html" CLASS="menu"
>
vamshi
</a>
</div>
<p>
am a page
</p>
</body>
</html>
happy new year,
shashi.
--
Be what all you can be.