Click to See Complete Forum and Search --> : onRightClick event handler


xXxZom_biExXx
01-14-2003, 02:50 AM
Is there a way to use the onRightClick event handler to make it so when someone right clicks on a page it will take them back to the previous page?

kinda like onRightClick="javascript:history.back();

if you'll excuse me i am javascript ignorant

and if this can be done where do i put the caode at? Iniside the head of the html, in the body tag, etc?

any help is appreciated

Thanks,
Zom_biE

xXxZom_biExXx
01-14-2003, 10:08 PM
i tried putting that in both the body and the head of the html code but neither worked. It isnt a necessity, just thought it would be nice to have somethin a little different. but thanks for replying

pyro
01-14-2003, 10:44 PM
Here is a modified no right click script. This works in IE6 and NN7...

<script type="text/javascript">
function clickIE()
{
if (document.all)
{
}
}
function clickNS(e)
{
if
(document.layers||(document.getElementById&&!document.all))
{
if (e.which==2||e.which==3)
{
}
}
}
if (document.layers)
{
document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;
}
else
{
document.onmouseup=clickNS;document.oncontextmenu=clickIE;
}
document.oncontextmenu=new Function("history.go(-1);return false")


</script>

xXxZom_biExXx
01-14-2003, 11:10 PM
thats awesome, it worked (the last one you posted), THANK YOU VERY MUCH

xXxZom_biExXx
01-16-2003, 12:55 PM
sorry, when i got a reply i was in such a rush to try it out i only tried pyros and that was the one that i relied to, i just tried out yours Dave and it worked like a charm also. thank you both very much, and sorry for the confusion.

stalepretzel59
12-27-2006, 11:19 AM
Hey, is there such thing as onLeftClick ?

felgall
12-27-2006, 07:14 PM
For those browsers strupid enough to not have the right click intercept disabled it can be accessed as oncontextmenu so setting that to null will disable right click in browsers with incorrect security settings.