473,399 Members | 4,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Right Click Menu

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

Jul 23 '05 #1
5 2274
"MisterG" <gl**********@rogers.com> wrote in message
news:Ir********************@rogers.com...
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


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/...lickmenu.shtml

--
Matthew Hagston
Jul 23 '05 #2
Thank you. That's all I needed!

"Matthew Hagston" <ot***@earthlink.net> wrote in message
news:yf**************@newsread2.news.atl.earthlink .net...
"MisterG" <gl**********@rogers.com> wrote in message
news:Ir********************@rogers.com...
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

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/...lickmenu.shtml

--
Matthew Hagston

Jul 23 '05 #3
Matthew Hagston wrote:
"MisterG" <gl**********@rogers.com> wrote in message
news:Ir********************@rogers.com...
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!');
}
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.

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

Thank you
Glenn

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/...lickmenu.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?
--
Zif
Jul 23 '05 #4
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

"Zifud" <Zi***@hotmail.com> wrote in message
news:Lu****************@news.optus.net.au...
Matthew Hagston wrote:
"MisterG" <gl**********@rogers.com> wrote in message
news:Ir********************@rogers.com...
Using the following code I am able to open a new window when a user rightclicks an object in my document.

if (window.event.button == 2) {
Win1 = window.open("","","height=200,width=200");
Win1.document.write('Right click!');
}
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.

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

Thank you
Glenn

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/...lickmenu.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?
--
Zif

Jul 23 '05 #5
"MisterG" <gl**********@rogers.com> wrote in message
news:Et********************@rogers.com...
Thank you. That's all I needed!

"Matthew Hagston" <ot***@earthlink.net> wrote in message
news:yf**************@newsread2.news.atl.earthlink .net...
"MisterG" <gl**********@rogers.com> wrote in message
news:Ir********************@rogers.com...
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


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/...lickmenu.shtml

--
Matthew Hagston


Well, the one I designed worked on all sytems including opera (providing you
had javascript mouse events enabled). Haven't had time to find it yet
though. That was just given as an example of how to do it that i could find
easily on the net.

--
Matthew Hagston
Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Anand Ganesh | last post by:
Hi All, When the user right clicks on the desktop or selects a file and right clicks the mouse he should see our own submenu along with the Windows context menu. How will I do this in Visual C#...
11
by: Terry Olsen | last post by:
How can I catch a right-click on a DropDownMenuItem?
2
by: Hardik Shah | last post by:
Hi, I want to create menu , when my user right click from combo box's list item. I use Contextmenu property of combobox and assign menu for it, but it only effected when combobox's list item not...
5
by: wxnut | last post by:
In VB 2005 I have six seperately named picture boxes (arranged in a table layout control) in which I plot different X/Y data lines. I would like to be able to right-click on a specific picture box...
4
by: Przemek M. Zawada | last post by:
Dear Group, I have written a software (C#/VS2005), which enter current directory, match all requested files and rename it recursively (removing special chars, etc). What I want is to add in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.