PDA

View Full Version : right click without pop up menu appearing?


CreekDawg99
03-21-2003, 08:26 PM
I have a view of a map on my web page that is in an img (the map is a dynamically created image created by an activeX object).

I am trying to use the left button to zoom in on the map and the right button to zoom out. The click increases or decreases a number (Between 0 and 10) to set the zoom level.

Both buttons work fine as far as zooming goes but in Inernet Explorer, when I do the right click, the IE Pop-Up Menu displays (Back...Forward...Save Background As...). The only way I can seem to make this menu not pop up is to call an Alert box but this is not an option. Is there a way I can force this pop-up menu to not show when right clicking on the image?

Code:

if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2)
{
// zoom out (right click)
if (nZoomSetting <= 0)
{
alert("Can not zoom out anymore");
return false;
}
nZoomSetting = nZoomSetting - 1;
}
else if (navigator.appName == 'Microsoft Internet Explorer' && event.button==1)
{
// zoom in (left click)
if (nZoomSetting >= 9)
{
alert("Can not zoom in anymore");
return false;
}
else
{
nZoomSetting = nZoomSetting + 1;
}
}
strURL = aryLocation[0] + "&mapZoomLevel=" + nZoomSetting;
location.href = strURL;
return false;


Thanks in advance for the help.

Quiet Storm
03-21-2003, 09:31 PM
You could try this:

<BODY onContextMenu="return false;">

CreekDawg99
03-21-2003, 09:47 PM
well that sure was kind of easy. Here I was searching the web for some sort of complex answer and a body tag took care of it. That is exactly what the doctor ordered. Thank you much for your help.