Right Click Menu

M

MisterG

Using the following code I am able to open a new window when a user right
clicks an object in my document.

if (window.event.button == 2) {
Win1 = window.open("","","height=200,width=200");
Win1.document.write('Right click!');
}

The problem is that the default menu that normally appears is still
appearing. How do I suppress the right-click menu?

Thank you
Glenn
 
Z

Zifud

Only in IE. There is no attempt to make it work in browsers that
don't support window.event and it will be defeated by pop-up
blockers.

It likely won't work on systems that implement right mouse button
functionality without actually having one.
Initially I did this by inserting a clear 1x1 px gif at the mouse point
while the mouse was down. There is an easier way to do it however by
canceling the event. Can't seem to remember the trick off the top of my head
though. I should have a copy stored on my home computer...but in the mean
time i found this:

http://www.javascriptkit.com/script/script2/rightclickmenu.shtml

That is IE specific code that does not work in any browser that does
not support "window.createPopup", that has a pop-up blocker enabled
or has JavaScript disabled.

Changing the default behaviour of the user's interface only creates
confusion, what is the point?
 
M

MisterG

Maybe for the internet, but this is an in intranet application requiring
custom functionality, distributed on a standardized platform ( IE ). So it's
perfect for our purposes.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,129
Latest member
FastBurnketo
Top