...

View Full Version : Disabling Rightclick_ popup window



ramakrishna p
01-25-2006, 08:44 AM
Hi everybody,
Can anyone please help me with javascript concern. Iam getting image popup window alright but I dont wont someone copy my image.Ofcourse there are other ways to copy images (like screen shots)..but atleast to created some sort of caution to the visitors who try to copy the images. Below is the code for image popup window...but I want to disable the right click in image popup window. Please help me out....
Advance thanks for any help!

<td>
<a href="#"><img src="images/gallery/T_BabagangapurArthirudram.jpg" alt="baba gangapur arthirudram" width="141" height="141" border="0" onClick="MM_openBrWindow('images/gallery/BabagangapurArthirudram.jpg','BabaGangapurArthirudram','status=yes,width=420,height=276')"></a>
</td>

MRMAN
01-25-2006, 09:55 AM
this seems to work for me


<script language=JavaScript>
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
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=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("return false")
</script>

ramakrishna p
01-25-2006, 10:09 AM
Thank you MRMAN,
Copied the code...Where should I place this? In header part? Iam trying.
Regards
Ramakrishna

ramakrishna p
01-25-2006, 10:40 AM
Hi MRMAN!

The following is the code for disabling righclick for main window. This code I had as .js file in the directory of htmls. Main window showing disable rightclick alright. But I want right click disable for image popup window. I tried.. your code is not working for me! Any othercodes can you suggest?


<!--

function disable_right_click(e)
{
var browser = navigator.appName.substring ( 0, 9 );
var event_number = 0;
if (browser=="Microsoft")
event_number = event.button;
else if (browser=="Netscape")
event_number = e.which;

if ( event_number==2 || event_number==3 )
{
alert ("All Image Copyrights Reserved for \nDigital Dental Strategies, Inc.");
return (false);
}

return (true);
}

function trap_images_mouse_events ()
{
if ( document.images )
{
for (var pic=0; pic<document.images.length; pic++)
document.images[pic].onmousedown = disable_right_click;
}
}

var debug = true;
function right(e)
{
var today = new Date();
yr = "2001";

nextyr = today.getYear();

if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
alert('Thank you for visiting! Copyrighted content of Dattagru Bhandara Trust (Regd).\n Copyright ' + yr + '-' + nextyr);
return false;
}

else if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) {
x = String(yr);
y = String(nextyr)
x = x.substring(1,3);
y = y.substring(1,3);
alert('Copyright&#169; 20' + x + '-20' + y);
return false;
}

return true;
}

document.onmousedown=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
window.onmousedown=right;

function PopUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'width=630,height=471,left=10,top=10,toolbar=no,location=no,status=no,menubar=no,resizable=no');");
}
//-->



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum