Loan - Loans - Loans - Israel Basketball - Problem Mortgage

PDA

View Full Version : Code for right click event


James McMurray
Dec 3rd 2007, 1:22 pm
Yes, I know it's frowned upon. Yes, I know the world is safer if neophyte coders aren't allowed these atrocities. And yes, I know it won't work in some browsers.

But I still want to do it. :)

I've got some code that works great onclick. However, it's set up to change an input box's background color, so running it onclick is not going to work. I can do it on control click, but eventually I'll be adding other right click options to the app, so would like to consolidate them all under one roof so-to-speak.

Can someone please post or point me to a snippet that will check for a right click and disable the browser's right click menu if possible?

Thanks,
James

sharry
Dec 3rd 2007, 1:31 pm
I found out this nice piece of code which works for ie http://javascript.internet.com/page-details/right-click-menu.html it disables the usual right click and gives a different set of menus

James McMurray
Dec 3rd 2007, 4:15 pm
Thanks! That had the oncontextmenu stuff I was missing. Everything's running great now!

Here's what I'm using it for (http://www.colugo.org/jmcmurra/generators_test/tools/cp.htm) (it's actually going into a bigger app, but that's the test file I used). Right click on any of the input boxes labelled "name" and you can change it's background color. It's for this (http://www.colugo.org/jmcmurra/generators_test/tools/wheel/wheel.php), so people can sort the counters more easily.

sharry
Dec 5th 2007, 10:41 am
amazing stuff nice work :)

James McMurray
Dec 5th 2007, 1:18 pm
Thanks, although most of the color picker is someone else's work. I just changed the color array and told it to work on the background color of the target instead of changing the text in a hidden input box like the original did.