Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Code help for web
#1
I have to disable right clicking on a web page...I have the code but it didn't work when I put it in the site. Does it need to go somewhere specific?

(code)

<SCRIPT LANGUAGE="JavaScript1.1">
<!-- Original: Martin Webb ([email protected]) -->


<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! JavaScript Source: Free JavaScripts, Tutorials, Example Code, Reference, Resources, And Help -->


<!-- Begin
function right(e) {
if (navigator.appName == 'Netscape' &&
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' &&
(event.button == 2 || event.button == 3)) {
alert("Not here! ");
return false;
}
return true;
}


document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;
// End -->
</script>
[SIGPIC][/SIGPIC]
Nobody can go back and start a new beginning, but anyone can start today and make a new ending
Reply
#2
Simply add the following code to the <BODY> section of your web page (Press Ctrl C after selecting code to copy it):

<script language=JavaScript>
<!--
//Disable right click script III- By JUkE ([email protected])
//
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>
Reply
#3
I'm going to assume that the 'Information Technician' under your name means you know what you are doing...right? Using another code is a bit scary.
[SIGPIC][/SIGPIC]
Nobody can go back and start a new beginning, but anyone can start today and make a new ending
Reply
#4
What cms are you running? For vbulletin you will want to put the code at the top of the header template, Ipb at the top of the global_board_header template. If that code doesn't work correctly there is also a disable hotlink mod
Reply
#5
im taking it that he is working with html and not php
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  need color code help skidude 2 294 08-29-2007, 07:04 AM
Last Post: skidude

Forum Jump:


Users browsing this thread: 1 Guest(s)