•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 401,707 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,970 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1716 | Replies: 6 | Solved
![]() |
•
•
Join Date: Mar 2006
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
Hai group,
im a newbie in HTML,CSS,JAVASCRIPT..
I was involved in dev of a prototype using the above 3...
everything went fine...but the pending requirement is ..
when we right click on a row in table in a prototype, we have coded such that a context menu appears..its working fine..but if we click on empty space in the html prototype, we r getting the default context menu which we dont want...
could any one of u can help me plzzzzzzz
im a newbie in HTML,CSS,JAVASCRIPT..
I was involved in dev of a prototype using the above 3...
everything went fine...but the pending requirement is ..
when we right click on a row in table in a prototype, we have coded such that a context menu appears..its working fine..but if we click on empty space in the html prototype, we r getting the default context menu which we dont want...
could any one of u can help me plzzzzzzz
Wait... I know IE provides an "oncontextmenu" event handler. I'm not sure about FireFox.
You could code that in the body, as so:
However, this is where I make my standard plea/warning: users expect that when they right-click, they get a context menu. I, for example, routinely use it to access "back". It's faster than mousing up to the top of the browser. Disabling or co-opting features that users have come to expect violates a basic application design principle, and should be avoided, in my opinion.
So unless you have a very compelling reason for doing this, I would suggest that you leave it alone.
You could code that in the body, as so:
<body oncontextmenu="return false;">
However, this is where I make my standard plea/warning: users expect that when they right-click, they get a context menu. I, for example, routinely use it to access "back". It's faster than mousing up to the top of the browser. Disabling or co-opting features that users have come to expect violates a basic application design principle, and should be avoided, in my opinion.
So unless you have a very compelling reason for doing this, I would suggest that you leave it alone.
•
•
Join Date: Mar 2006
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
•
•
•
•
Originally Posted by tgreer
Wait... I know IE provides an "oncontextmenu" event handler. I'm not sure about FireFox.
You could code that in the body, as so:
<body oncontextmenu="return false;">
However, this is where I make my standard plea/warning: users expect that when they right-click, they get a context menu. I, for example, routinely use it to access "back". It's faster than mousing up to the top of the browser. Disabling or co-opting features that users have come to expect violates a basic application design principle, and should be avoided, in my opinion.
So unless you have a very compelling reason for doing this, I would suggest that you leave it alone.
We're venturing off into another discussion. I don't know the particulars of the OP's environment or application, but in general, I say "hands off" on anything that is in the User Model. This includes such often-requested items as auto-sizing a window, auto-printing a page, disabling certain script warnings, obscuring or making "View Source" difficult, and replacing or editing the context menu.
This link should be of interest to you in regard to adding to context menu(s):
http://msdn.microsoft.com/workshop/b...ls/context.asp
This link should be of interest to you in regard to adding to context menu(s):
http://msdn.microsoft.com/workshop/b...ls/context.asp
•
•
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation:
Rep Power: 7
Solved Threads: 107
That's something you have to do internally to your windows machine though (which rocks for me, but not for someone trying to do it through a web page... now if we can find out where that same type of key is for firefox).
If I'm not mistaken, you could use a DIV with some crazy CSS (to hide and show the div) with an absolute positioning, set the oncontextmenu to a function (which shows the div, and returns false for the actual context menu), but the context menu has things that you can't make happen within a page.
but I seriously agree with tgreer, screwing with people's interface is a bad idea.... 9 times out of 10, if a page is messing with things I don't think it should be, I'm gone. I won't stay there. I don't even like pages playing music, or embedding objects (like media player) when I first navigate there. Now, I've done this before (made a page which replaces the context menu), but I made it a choice in preferences, and I made it disabled by default (meaning, in order to use my div menu, they had to consciously go in and turn it on), and beyond that, I made an option in the DIV for "Standard Menu" so when they clicked that, it would load the normal context menu the next time they clicked.
If you feel absolutely drawn to having to affect the users interface, words of wisdom say to make sure that the user can get back to a familar environment with no effort.
If I'm not mistaken, you could use a DIV with some crazy CSS (to hide and show the div) with an absolute positioning, set the oncontextmenu to a function (which shows the div, and returns false for the actual context menu), but the context menu has things that you can't make happen within a page.
but I seriously agree with tgreer, screwing with people's interface is a bad idea.... 9 times out of 10, if a page is messing with things I don't think it should be, I'm gone. I won't stay there. I don't even like pages playing music, or embedding objects (like media player) when I first navigate there. Now, I've done this before (made a page which replaces the context menu), but I made it a choice in preferences, and I made it disabled by default (meaning, in order to use my div menu, they had to consciously go in and turn it on), and beyond that, I made an option in the DIV for "Standard Menu" so when they clicked that, it would load the normal context menu the next time they clicked.
If you feel absolutely drawn to having to affect the users interface, words of wisdom say to make sure that the user can get back to a familar environment with no effort.
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- HDD Context Menu gone Awry (Windows NT / 2000 / XP / 2003)
- context menu (VB.NET)
- slow startup and modem speed (Viruses, Spyware and other Nasties)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Please help, been a few years.
- Next Thread: Dynamically write selectedIndex to a <dl> element



Linear Mode