最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
常用的JS禁止右击菜单、复制、选择代码
时间:2012-05-14 编辑:简简单单 来源:一聚教程网
function key(){
if(event.shiftKey){
window.close();}
//禁止Shift
if(event.altKey){
window.close();}
//禁止Alt
if(event.ctrlKey){
window.close();}
//禁止Ctrl
return false;}
document.onkeydown=key;
function nocontextmenu(){
//alert("a");
try{
event.cancelBubble = true
event.returnValue = false;
}catch(e){
}
return false;
}
function norightclick(){
if (event.button == 2 || event.button == 3){
//alert("a");
try{
event.cancelBubble = true
event.returnValue = false;
}catch(e){
}
return false;
}
}
document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
document.onselectstart = function(){
return false;
}
document.ondragstart = function(){
return false;
}
相关文章
- HTML简单购物数量小程序代码展示 10-31
- html canvas实现弹幕功能 10-31
- HTML中空格表示的意义 10-31
- html area标签解读 10-31
- html使用表单标签实现注册页面代码展示 10-31
- 使用HTML截图并保存为本地图片的代码展示 10-31