Hopefully a quick question:
I have items (links) on my page that if you left-click on them they go to the corresponding page. However, if you right-click them, a customized menu comes up. My problem is that I don't want the default right-click browser menu to pop up. I have tried using the event.cancelBubble parameters, but have thus far been unsuccessful. I am most interested in IE code, but would ultimately like IE & Netscape. I have seen other examples of this working, but all involved an alert dialog, which I don't want.
My basic code is as follows:
<a href=http://www.webdeveloper.com/forum/archive/index.php/"url goes here" onMouseDown="return openMenu(event);">
<span id="menu" style="width: 25px; height: 40px; visibility: hidden; top: 0px; left: 0px">Menu goes here</span>
<script language="javascript">
function openMenu(evt) {
if (evt.button == 2) {
var elem = document.getElementById("menu").style;
elem.top = evt.y + "px";
elem.left = evt.x + "px";
elem.visibility = "visible";
// Not sure how to keep event from propagating up to
// the browser menu.
}
}
</script>
I have items (links) on my page that if you left-click on them they go to the corresponding page. However, if you right-click them, a customized menu comes up. My problem is that I don't want the default right-click browser menu to pop up. I have tried using the event.cancelBubble parameters, but have thus far been unsuccessful. I am most interested in IE code, but would ultimately like IE & Netscape. I have seen other examples of this working, but all involved an alert dialog, which I don't want.
My basic code is as follows:
<a href=http://www.webdeveloper.com/forum/archive/index.php/"url goes here" onMouseDown="return openMenu(event);">
<span id="menu" style="width: 25px; height: 40px; visibility: hidden; top: 0px; left: 0px">Menu goes here</span>
<script language="javascript">
function openMenu(evt) {
if (evt.button == 2) {
var elem = document.getElementById("menu").style;
elem.top = evt.y + "px";
elem.left = evt.x + "px";
elem.visibility = "visible";
// Not sure how to keep event from propagating up to
// the browser menu.
}
}
</script>