onbeforeactivate 对象要被设置为当前元素前立即触发。//这个禁用了按键功能
设置onbeforeactivate解决了JavaScript 1行 1列 跳出脚本错误!
右键禁用JavaScript
</script>
<script type="text/javascript" src="js/jquery1.42.min.js"></script>
<script type="text/javascript">
function OnActivate(e)
{
if (event.keyCode) {
return true;
}
return false;
}
$(function () {
//禁用右键
document.body.onbeforeactivate = OnActivate;
document.body.oncontextmenu = document.body.ondragstart = document.body.onselectstart = function () { return false; };
document.body.onselect = document.body.oncopy = document.body.onmouseup = function () { return false;/*document.selection.empty();*/ };
})
</script>