Copy Code code as follows:
function Click (e)
{
if (document.all)
{
if (event.button==1| | event.button==2| | EVENT.BUTTON==3)
{
Oncontextmenu= ' return false ';
}
}
if (document.layers)
{
if (E.which = 3)
{
Oncontextmenu= ' return false ';
}
}
}
if (document.layers)
{
Document.captureevents (Event.mousedown);
}
Document.onmousedown=click;
Document.oncontextmenu = new Function ("return false;")
var trxdyel=true
var hotkey=17/* Hotkey is the key value of the hotkey, is the ASII code, here 99 represents the C key * *
if (document.layers)
Document.captureevents (Event.keydown)
function Gogo (e)
{
if (document.layers)
{
if (E.which==hotkey && Trxdyel)
{
Alert (' Operation error. Maybe you pressed the wrong button! ');
}
}
else if (document.all)
{
if (Event.keycode==hotkey&&trxdyel) {alert (' Operation error ') Maybe you pressed the wrong button! '}
}
Document.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 the charset= "gb2312", or the message will be prompted garbled. Page reference:
Copy Code code as follows:
<script src= ". /script/xp.js "type=" Text/javascript "charset=" gb2312 "></script>
1. Will completely screen the right mouse button
Copy Code code as follows:
oncontextmenu= "Window.event.returnvalue=false"
<table border Oncontextmenu=return (false) > <td> no</table> available for table
function Click () {
if (event.button==2) {
Alert (' Sorry, this page disables the right button! ')
}
}
Document.onmousedown=click
2. Deselect, prevent replication
Copy Code code as follows:
<body onselectstart= "return false" >
3. No pasting
Copy Code code as follows:
4. Prevention of duplication
Copy Code code as follows:
Oncopy= ' return false; ' oncut= ' return false;
JavaScript shortcut key Settings Implementation code