Home Advanced Code No Right Click On Images Only

No Right Click On Images Only

E-mail Print PDF
Don't want visitors to be able to right click on your images?

Paste this into the head of your webpage:

Code:
<script language="JavaScript1.2">
 
 
/*
 Disable right click script II (on images)- By Dynamicdrive.com
 For full source, Terms of service, and 100s DTHML scripts
 Visit http://www.dynamicdrive.com
 */
 
 
var clickmessage="Right click disabled on images!"
 
 
function disableclick(e) {
 if (
document.all) {
 if (
event.button==2||event.button==3) {
 if (
event.srcElement.tagName=="IMG"){
 
alert(clickmessage);
 return 
false;
 }
 }
 }
 else if (
document.layers) {
 if (
e.which == 3) {
 
alert(clickmessage);
 return 
false;
 }
 }
 else if (
document.getElementById){
 if (
e.which==3&&e.target.tagName=="IMG"){
 
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.getElementById)
 
document.onmouseup=disableclick
 
else if (document.layers)
 
associateimages()
 
</script> 

 

Domain Names

Sample image .com .info
.mobi .net
.org .tv .us
.biz .ws .name
.am .at .be .cc .cn .de .eu
.fm .jobs .jp .ms .nu .nz
.tc .tw .uk .vg .ASIA .ME

Website Hosting

Sample image We're the affordable, reliable place to host your site. And unlike the competition, there's no set up fee and no annual commitment.

24/7 Support

Sample image Our highly trained, courteous support staff is waiting to help. We'll resolve any issue to your complete satisfaction.