java55
04-13-2010, 01:59 AM
Hello everyone !!! This is the problem I'm having:
I'm trying to incorporate a Right-Click-Disable script into my webpage by using an external .js file since I have several pages in my website. The thing is that when I run it I get an INVALID CHARACTER error pointing to Line 1 Character 1 of the .js file and I just can't seem to find the error. Here are the HTML and .js files I'm using (in an empty webpage to run as test) :
-----------------------
THE HTML FILE:
<html>
<head>
<script type="text/javascript" src="disablemouse.js">
</script>
</head>
<body>
</body>
<p>
<body>
</body>
</html>
-------------------------
THIS IS THE disablemouse.js FILE:
<!--
//Disable right click script III- By Renigade(renigade@mediaone.net)
//For full source code, visit http://www.dynamicdrive.com
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")
// -->
-------------------------
I'm using Front page as my webpage editor. When I run it without the .js file it works perfect, the problem comes when I use the external file approach.
Thanks.
I'm trying to incorporate a Right-Click-Disable script into my webpage by using an external .js file since I have several pages in my website. The thing is that when I run it I get an INVALID CHARACTER error pointing to Line 1 Character 1 of the .js file and I just can't seem to find the error. Here are the HTML and .js files I'm using (in an empty webpage to run as test) :
-----------------------
THE HTML FILE:
<html>
<head>
<script type="text/javascript" src="disablemouse.js">
</script>
</head>
<body>
</body>
<p>
<body>
</body>
</html>
-------------------------
THIS IS THE disablemouse.js FILE:
<!--
//Disable right click script III- By Renigade(renigade@mediaone.net)
//For full source code, visit http://www.dynamicdrive.com
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")
// -->
-------------------------
I'm using Front page as my webpage editor. When I run it without the .js file it works perfect, the problem comes when I use the external file approach.
Thanks.