/    Sign up×
Community /Pin to ProfileBookmark

Disable right click in new popup window

Help! I have a script to open a new window when a thumbnail is clicked, but how can I disable right click in the new wiondow?

This is the script I have:

<script>
<!— Hide script from old browsers

function OpenNewWindow2(cPicture,nWidth,nHeight,cMessage,nBorder)
{
NewWindow=window.open(“”,”NewOne”,”HEIGHT=”+nHeight+”,WIDTH=”+nWidth+”,scrollbars=no,resizable=no,top=5,left=5″);
NewWindow.document.write (“<HTML><HEAD><TITLE>”);
NewWindow.document.write (“</TITLE></HEAD>”);
NewWindow.document.write (“<BODY BGCOLOR=’#993333′>”);
NewWindow.document.write (“<P ALIGN=CENTER>”);
NewWindow.document.write (“<FONT FACE=’Arial’ SIZE=’+2′ COLOR=’Black’><B>”);
NewWindow.document.write (cMessage);
NewWindow.document.write (“</B></FONT>”);
NewWindow.document.write (“<IMG SRC=”);
NewWindow.document.write (cPicture);
NewWindow.document.write (“>”);
NewWindow.document.write (“</P>”);
NewWindow.document.write (“<center><FORM><INPUT TYPE=’button’ VALUE=’Close This Window’ onClick=’self.close()’>”);
NewWindow.document.write (“</FORM></CENTER>”);
NewWindow.document.write (“<p>”);
NewWindow.document.close();
return false;
}
var message=”Function Disabled!”;

///////////////////////////////////
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(“alert(message);return false”)

// end hiding from old browsers –>
</script>

<!– This is the thumbnail //–>
<div align=”center”><a href=# onClick=”OpenNewWindow2(‘cr1252.jpg’,400,320,’CR125R’);return false;”><img src=”../../../javascripts/cr125r.gif” width=”136″ height=”99″ alt=”” border=”0″></a></div>

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@steelersfan88Mar 23.2004 — please do not double post in one forum, the question was given in my original reply. The code I provided works fine, you have to make the adjustments I sent in my recent reply
×

Success!

Help @Dallasjmoore spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...