Right you should be able to copy and paste the code below without it being corrupted.
This is the no right click and no left click code for images and texts as polished and finished by MikeyRed. The code below does not give you a pop up message (I'll post that one in a moment).
It works with FF and IE but I haven't tested it anywhere else yet.
Code:
<SCRIPT language=JavaScript>
<!--
function clickIE() {if (document.all) {alert(message);return false;}}
function clickNS(e) {
if (e.target.type == "text") { return true; }
if (e.target.type == "textarea") { return true; }
if (e.target.type == "submit") { return true; }
if (e.target.type == "checkbox") { return true; }
if (e.target.type == "radio") { return true; }
if(document.layers||(document.getElementById&&!document.all)){
if (e.which==2||e.which==3) {alert(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
function noclic(clic) {
if (navigator.appName == 'Netscape' && clic.which==3) {
alert(msg);
return false;}
else
if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) {
alert(msg);
return false;
}
return true;
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown = noclic;
// -->
</SCRIPT>
<script>
function disableselect(e){
if (e.target.type == "text") { return true; }
if (e.target.type) =="textarea") { return true; }
if (e.target.type == "submit") { return true; }
if (e.target.type == "checkbox") { return true; }
if (e.target.type == "radio") { return true; }
if (e.target.type == "password") { return true; }
return false;
}
function reEnable(){
return true
}
//if IE4+
document.onselectstart=new Function ("return false")
//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
</script>
And same code again with pop up message to annoy/inform your customers/thief!
Code:
<SCRIPT language=JavaScript>
<!--
var message="Copyright ©2008 Your Company LTD. All Rights Reserved.";
function clickIE() {if (document.all) {alert(message);return false;}}
function clickNS(e) {
if (e.target.type == "text") { return true; }
if (e.target.type == "textarea") { return true; }
if (e.target.type == "submit") { return true; }
if (e.target.type == "checkbox") { return true; }
if (e.target.type == "radio") { return true; }
if(document.layers||(document.getElementById&&!document.all)){
if (e.which==2||e.which==3) {alert(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
function noclic(clic) {
var msg="Copyright ©2008 Green Bear UK Ltd. All Rights Reserved.";
if (navigator.appName == 'Netscape' && clic.which==3) {
alert(msg);
return false;}
else
if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) {
alert(msg);
return false;
}
return true;
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown = noclic;
// -->
</SCRIPT>
<script>
function disableselect(e){
if (e.target.type == "text") { return true; }
if (e.target.type == "textarea") { return true; }
if (e.target.type == "submit") { return true; }
if (e.target.type == "checkbox") { return true; }
if (e.target.type == "radio") { return true; }
if (e.target.type == "password") { return true; }
return false;
}
function reEnable(){
return true
}
//if IE4+
document.onselectstart=new Function ("return false")
//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
</script>
EDIT at 15:51 on 18/11/08 I've just added a missing line of code in so that the "message" box on your "contact us" forms should now work