Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with "No right click" function in frames. 1

Status
Not open for further replies.

soonkhoo

Programmer
Dec 8, 2000
133
MY
Hi all,

I found a no right click script... it works fine if I have no frames. But when I placed in the main frame... it didn't work. What should I do?

Here is the script. I have a Top frame(topFrame) and target(content).


<SCRIPT language=&quot;JavaScript&quot;>
<!--
var msg = &quot;:p No right click for you!&quot;;
if(document.layers) window.captureEvents(Event.MOUSEDOWN);

function no_click(e){
if (navigator.appName == 'Netscape' &amp;&amp; ( e.which == 2 || e.which == 3))
{
alert(msg);return false;
}
if (navigator.appName == 'Microsoft Internet Explorer' &amp;&amp; (event.button == 2 || event.button == 3))
{
alert(msg);return false;
}
}
window.onmousedown=no_click;
document.onmousedown=no_click;
//-->
</SCRIPT>


Thanks.

Regards,
SOon
 
Oh! I forgot to add something... My page has a Table in it. Should I paste it in the Table or just before </body>?

Regards,

Soon
 
usually it's in the header
<html>
<head>
...
<script>
...
</script>
</head>
<body>
...
</body>
</html>

and what do you mean, &quot;it's not working&quot; ? not at all ? only in one of the 2 frames ?
 
SOrry, it works now... I put it in the head and call it in the <body> tag instead...Thanks.

Soon
 
i love it when it's so quick to fix ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top