The code is as follows:
1 function Click (e)2 { 3 if(document.all)4 { 5 if(Event. button==1||Event. button==2||Event. button==3) 6 { 7oncontextmenu='return False'; 8 } 9 } Ten if(document.layers) One { A if(E.which = =3) - { -oncontextmenu='return False'; the } - } - } - if(document.layers) + { - document.captureevents (event.mousedown); + } Adocument.onmousedown=Click; atDocument.oncontextmenu =NewFunction ("return false;") - varTrxdyel=true - varhotkey= - /*Hotkey is the key value of the hotkey, is the ASII code, here 99 for the C key*/ - if(document.layers) - document.captureevents (Event.keydown) - function Gogo (e) in { - if(document.layers) to { + if(E.which==hotkey &&Trxdyel) - { theAlert'Operation error. Maybe you pressed the wrong button!'); * } $ } Panax Notoginseng Else if(document.all) - { the if(Event. Keycode==hotkey&&trxdyel) {alert ('Operation error. Maybe you pressed the wrong button!'); }} + } ADocument.onkeydown=gogo
The above JS code to write to the JS file named Xp.js and put into the script folder, the reference needs to pay attention to set charset= "gb2312", otherwise the message will be garbled. Page References:
The code is as follows:
1 <script src=". /script/xp.js "type="text/javascript" charset="gb2312 "></script>
1. The right mouse button will be completely shielded
1oncontextmenu="Window.event.returnvalue=false" 2<table Border oncontextmenu=return(false) > <td> no</table>Available for table3 function Click () {4 if(Event. button==2) { 5Alert'Sorry, the right button is disabled on this page! ') 6 } 7 } 8Document.onmousedown=click
2. Deselect, prevent copying
1 <body onselectstart="return False">
3. No pasting
1 onpaste="return False"
4. Prevent replication
1 oncopy="return false; " oncut="return false; "
JS Input text box disable right-click and copy-paste function code