This example shows how to prevent a context menu from appearing by canceling the oncontextmenu event handler.
<span style="width: 300px; background-color: blue; color: white;"
>
The context menu never displays when you right-click in this box. </span>
<script type="text/javascript">
var selectedArea = null;
function activate(e,f) {
selectedArea = f ? e : null;
}
function menu(e) {
if (selectedArea)
alert('right-click: ' + selectedArea.id);
else {
// cross-browser case
if (e.tagName == 'AREA')
alert('right-click: ' + e.id);
else
alert('right-click: ' + e.tagName);
}
return false;
}
</script>
<map id="Map0">
<area id="Area1"
shape="rect" coords="100, 50, 200, 150" href="..."/>
</map>
<img src="..." usemap="#Map0" />