View Complete Thread | FoxWeb Forum Home
Search:
Date:    Msg ID:   
From:    Thread:   
Subject:   
This one works for me in a page with 3 frames but I have to put it in each frame. I use <%=FILETOSTR('include/disablerightclick.txt')%> just after the <BODY>. Give it a try.
 
<BODY>
<%=FILETOSTR('include/disablerightclick.txt')%>
 
 
***FILE disablerightclick.txt***
<script language=JavaScript>
var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
 </script>

Joe

Sent by Cas Nuy on 08/10/2002 05:35:40 AM:
Joe,
I tried it but it does not work. I am using frames, could that be the cause ?
 
Cas
Sent by Joe Goldsmith on 07/27/2002 08:25:22 PM:
Whee, I finally found a way to disable right-click to protect my code and I share it with you. Works in both .HTM and .FWX. I place it in a .txt file and call it using <%=FILETOSTR('disablerightclick.txt')%> just after teh body tag.
 
Enjoy
 
Joe
 
************************
code before body
...
<BODY>
<script language=JavaScript>
<!--
var message="Right-Click Disabled";
function click(e) {
if (document.all) {
if (event.button == 2) {
alert(message);
return false;
}
}
if (document.layers) {
if (e.which == 3) {
alert(message);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
// -->
</script>
...
code after script