js中的屏蔽的使用示例
JS 使用 示例 屏蔽
2023-06-13 09:15:03 时间
js屏蔽效果
复制代码代码如下:
/**屏蔽F1帮助*/
window.onhelp=function(){returnfalse;}
/**
*屏蔽F5、Ctrl+N、Shift+F10、Alt+F4
*如果想要屏蔽其他键,则找到对应的keyCode再依照此方法即可
*/
document.onkeydown=function(event){
event=window.event||event;
if(event.keyCode==116||(event.ctrlKey&&event.keyCode==78)||(event.shiftKey&&event.keyCode==121)||(event.altKey&&event.keyCode==115)){
event.keyCode=0;
event.returnvalue=false;
}
}
/**屏蔽鼠标右键*/
document.oncontextmenu=function(){returnfalse;}
//或者
document.onmousedown=function(event){
event=window.event||event;
if(document.all&&event.button==2){
event.returnvalue=false;
}
}
/**
*屏蔽“后退”功能(<ahref="javascript:replaceLocation("http://www.google.com")"mce_href="javascript:replaceLocation("http://www.google.com")">Google</a>)
*@paramurl页面要转向的URL
*/
functionreplaceLocation(url){
document.location.replace(url);
}
/**屏蔽选中网页内容*/
document.onselectstart=function(){returnfalse;}
/**屏蔽复制网页内容*/
document.body.oncopy=function(){returnfalse;}
/**屏蔽剪切网页内容*/
document.body.oncut=function(){returnfalse;}
/**屏蔽向网页粘贴内容*/
document.body.onpaste=function(){returnfalse;}
/**屏蔽拷屏(不停的清空剪贴板)*/
window.setInterval("window.clipboardData("Text","")",100);
/**
*屏蔽查看源文件(<bodyonload=clear()>)
*/
functionclear(){
varsource=document.body.firstChild.data;
document.open();
document.close();
document.body.innerHTML=source;
}
/**
*屏蔽js报错
*/
functionKillError()
{
returntrue;
}
window.onerror=KillError;
相关文章
- js 字符串截取substr和substring详解
- js Date 使用详解[通俗易懂]
- JS对象转数组_js怎么把数组转成对象
- Web Spider Fiddler - JS Hook 基本使用
- 使用Redis和JS优化网页性能(redisjs)
- javascript(js)join函数使用方法介绍
- 我见过最全的个人js加解密功能页面
- js或css实现滚动广告的几种方案
- 用js获取电脑信息(是使用与IE浏览器)
- JS中eval函数的使用示例
- 使用非html5实现js板连连看游戏示例代码
- JS截取字符串常用方法整理及使用示例
- jqueryajax对特殊字符进行转义防止js注入使用示例
- asm.js使用示例代码
- 使用js如何实现全选与全不选
- js获取当前地址JS获取当前URL的示例代码
- 使用原生js写的一个简单slider
- 使用AjaxFileUpload.js实现异步文件上传示例
- node.js中的fs.linkSync方法使用说明
- node.js中的fs.lstat方法使用说明