473,405 Members | 2,210 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,405 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 2276
"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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.