1
Mods & Plugins (Releases & Support) / [Mod] Disable right click on images only
« on: February 20, 2003, 08:04:54 AM »
I have a script that I am currently using at pixelkitty.net to disable right click of images only.
This way, visitors can still use other right click functions such as bookmark, back, open in new window/tab etc on the page itself.
Is it possible to put this script into 4images instead of the current 'disable right click' script?
I want to do this as I find the current disable script is too restrictive, as I use right click extensively for navigation and other purposes when I am within my own sites.
The script I use at the above site is below, for those who may want it.
This way, visitors can still use other right click functions such as bookmark, back, open in new window/tab etc on the page itself.
Is it possible to put this script into 4images instead of the current 'disable right click' script?
I want to do this as I find the current disable script is too restrictive, as I use right click extensively for navigation and other purposes when I am within my own sites.
The script I use at the above site is below, for those who may want it.
Code: [Select]
// JavaScript Document
var clickmessage="© Copyright by {site_name}"
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()