Hey, I am able to disable the right mouse button on images for netscape
and IE but it won't work for Opera.
Here is the code:
// start of the code
var clickmessage="Sorry, you don't have permission to right-click."
function protectImages () {
if (document.all)
document.oncontextmenu=disableclick
else if (document.getElementById)
document.oncontextmenu=disableclick
else if (document.layers)
associateimages()
}
function disableclick(e) {
if (document.all) {
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.target.tagName=="IMG"){
alert(clickmessage)
return false
}
}
}
function associateimages(){
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}
// end of code ----
My question is:
How do I make the code work for Opera 7.x?
Thanks in advance.
--
Lijun
================================================== =====
Lijun Yang
mailto: ly****@austin.rr.com
================================================== =====