PDA

Click to See Complete Forum and Search --> : Disable right click popup //resolved//


mendhak
Jan 31st, 2003, 01:39 AM
To understand my question, head over to http://mendhak.worldjunkie.com/

It works if you're using IE.
Now, if you left click anywhere on the page, it goes over to phpinfo.html
If you right click anywhere on the page, however, the right click menu pops up, and then heads over to phpinfo.html

How can I get rid of this right click's menu?


Also, the javascript I'm using is this:


<script language="JavaScript">
function click(e) {
if(event.button==2){


document.location.href='phpinfo.html';
return true;
}
else
{
document.location.href='phpinfo.html';
}
}

document.onmousedown=click;

</script>


Anyone good with stuff for Netscape and the other non-IE browsers? How would I write the same script for those browsers?

Thanks.

joeframbach
Jan 31st, 2003, 05:43 AM
i think the onContextMenu event handles that menu thingy

mendhak
Jan 31st, 2003, 08:17 AM
Originally posted by joeframbach
i think the onContextMenu event handles that menu thingy

Great, thanks. I just had to put


<BODY onContextMenu = "return false;">


and the code worked fine.

mendhak
Jan 31st, 2003, 08:29 AM
I am now using this code:


<script language="JavaScript">


function redir(){
document.location.href='phpinfo.html';
}

document.onmousedown=redir;
</script>


Since onContextMenu has been eliminated. But now when I go to http://mendhak.worldjunkie.com/ I get "Syntax error on line 22" (It works fine on my machine).

Line 22 would be <body ... onContextMenu = "return: false;"

What have I done wrong?

mendhak
Jan 31st, 2003, 08:30 AM
And the right click context menu is showing up again. :(

joeframbach
Jan 31st, 2003, 09:07 AM
get rid of the : after return

mendhak
Jan 31st, 2003, 11:09 AM
:embarassed:

Must be all that CSS...