Not much nonsense to post code directly to everyone.

code show as below:

<script language="javascript">
//js code to disable certain keys
function key () {
if (event.shiftkey) {
window.close ();}
//Disable shift
if (event.altkey) {
window.close ();}
//Prohibit alt
if (event.ctrlkey) {
window.close ();}
//Prohibit ctrl
return false;}
if (window.event)
document.captureevents (event.mouseup);
function nocontextmenu () {
return false;}
function norightclick (e) {
if (window.event) {
if (e.which == 2 || e.which == 3)
return false;}
if (event.button == 2 || event.button == 3) {
return false;}
//Right-click prohibited
document.oncontextmenu=nocontextmenu;//for ie5 +
document.onmou<a href="/go.php?id=1141&s=al" target="_ blank">sed</a>own=norightclick;//for all others

<body onselectstart="return false";onpaste="return false";>

1. oncontextmenu="window.event.returnvalue=false" will completely block the right mouse button effect

<table border oncontextmenu=return (false)><td>no</table>available for table

2.<body onselectstart="return false">deselect, prevent copying

3. onpaste="return false" not allowed to paste

4. oncopy="return false;" oncut="return false;" prevent copying

ps:js prevents backwards,Refresh, close solution

<! Doctype html public "-//w3c //dtd html 4.0 transitional //en">
<title>new document</title>
<script language="javascript">
function runonbeforeunload () {window.onbeforeunload=function () {return "Unsaved data will be lost!";}}
<body onload="runonbeforeunload ()">
Refresh, close, back, f5 test

Although the onbeforeunload event has been eliminated by the web standard,But this event is the only one that can achieve this effect.Fortunately, browsers can support it very well.

Test Results:

ie6.0, firefox, chrome pass

  • Previous Simple implementation to limit the number of uploadify uploads
  • Next What does jquery form validation need to do