I do not personally know Javascript. I have created a script that will disable all right clicks anywhere on the page, and all clicks on images. I want to keep this functionality, with one exception, I want users to be able to left click on images that are links.
Do I need to add something to the IMG tag to bypass the script for those images, or do I need to modify the script?
Here is the current script I am using (like I said, I dont know Javascript, let me know if you see an easier way, or a way to improve it...)
Code:
<script language=JavaScript>
<!--
var clickmessage="These images are ©2002 by Bearfoot Technologies.\nAll Rights Reserved.\n\nYou may not copy, distribute, or otherwise use these\nimages without express written permission\nfrom Bearfoot Technologies.";
function clickNS(e)
{
if (document.all)
{
if(event.srcElement.tagName=="IMG")
{
alert(clickmessage);
return false;
}
else if (event.button==2||event.button==3)
{
return false;
}
}
else if (document.layers)
{
if (e.which==2||e.which==3)
{
return false;
}
}
else if (document.getElementById)
{
if (e.target.tagName=="IMG")
{
alert(clickmessage);
return false;
}
else if (e.which==2||e.which==3)
{
return false;
}
}
}
function disableclick(e)
{
if(document.layers)
{
alert(clickmessage);
}
}
function associateimages()
{
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}
if (document.all)
{
document.onmousedown=clickNS;
}
else if (document.getElementById)
{
document.onmouseup=clickNS;
}
else if (document.layers)
{
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS;
associateimages();
}
document.oncontextmenu=new Function("return false")
</script>