Click to See Complete Forum and Search --> : No Right Click


klbjornme
12-01-2003, 07:43 PM
I have used this code before on a page and it worked fine. Now it doesn't seem to work....did I mess it up somehow? Don't know how I could have, as I used copy-paste....but you never know....

Thanks

KL

<!--No Right Click
<script language="Javascript">
var clickmessage="Da Girls Say, 'Sorry, all pictures are

copyrighted!'"

function disableclick(e) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName=="IMG"){
alert(clickmessage);
return false;
}
}
}
if (document.layers) {
if (e.which == 3) {
alert(clickmessage);
return false;
}
}
}

function associateimages(){
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}

if (document.all)
document.onmousedown=disableclick
else if (document.layers)
associateimages()
</script><P>
// -- End No Right Click -->

fredmv
12-01-2003, 07:47 PM
I wouldn't recommend using any kind of script like that since they can be easily worked around and only result in annoyed users, however, all you need is this:<body oncontextmenu="return false;">

klbjornme
12-01-2003, 07:55 PM
Yeah, I hear what you are saying, but this is for a comic page, and I liked being able to have a message pop up when and if someone tried to right-click on a picture. :D

KL

fredmv
12-01-2003, 07:58 PM
I see. Well, check out the previous piece of code I posted. ;)