Copy codeThe Code is 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, which is an 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 have pressed the wrong key! ');
}
}
Else if (document. all)
{
If (event. keyCode = hotkey & trxdyel) {alert ('Operation error. Maybe you have pressed the wrong key! ');}}
}
Document. onkeydown = gogo
Write the above JS Code to the JS file and name it xp. js and put it into the Script folder. When referencing the Code, set Charset = "gb2312". Otherwise, the prompt message will be garbled. Page reference:
Copy codeThe Code is as follows:
<Script src = "../Script/xp. js" type = "text/javascript" charset = "gb2312"> </script>
1. the right mouse button will be completely shielded
Copy codeThe Code is as follows:
Oncontextmenu = "window. event. returnValue = false"
<Table border oncontextmenu = return (false)> <td> no </table>
Function click (){
If (event. button = 2 ){
Alert ('Sorry, right-click this page to disable it! ')
}
}
Document. onmousedown = click
2. Cancel selection and prevent Replication
Copy codeThe Code is as follows: <body onselectstart = "return false">
3. Do not paste
Copy codeThe Code is as follows: onpaste = "return false"
4. Prevent Replication
Copy codeThe Code is as follows: oncopy = "return false;" oncut = "return false ;"
JavaScript shortcut key setting implementation code