欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

js中的屏蔽的使用示例

 更新時(shí)間:2013年07月30日 15:52:21   作者:  
本文為大家介紹下js中的屏蔽的應(yīng)用;屏蔽網(wǎng)頁(yè)內(nèi)容選中、剪切、復(fù)制及拷屏總之你能想象的應(yīng)該都有,感興趣的朋友可以參考下,希望對(duì)大家學(xué)習(xí)js有所幫助
js屏蔽效果
復(fù)制代碼 代碼如下:

/** 屏蔽F1幫助 */
window.onhelp = function(){return false;}
/**
*屏蔽 F5、Ctrl+N、Shift+F10、Alt+F4
*如果想要屏蔽其他鍵,則找到對(duì)應(yīng)的 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;
}
}
/** 屏蔽鼠標(biāo)右鍵 */
document.oncontextmenu = function(){return false;}
//或者
document.onmousedown = function(event){
event = window.event || event;
if(document.all && event.button == 2) {
event.returnvalue=false;
}
}
/**
* 屏蔽“后退”功能(<a href="javascript:replaceLocation('http://www.google.com')" mce_href="javascript:replaceLocation('http://www.google.com')">Google</a>)
* @param url 頁(yè)面要轉(zhuǎn)向的URL
*/
function replaceLocation(url){
document.location.replace(url);
}
/** 屏蔽選中網(wǎng)頁(yè)內(nèi)容 */
document.onselectstart=function(){return false;}
/** 屏蔽復(fù)制網(wǎng)頁(yè)內(nèi)容 */
document.body.oncopy = function(){return false;}
/** 屏蔽剪切網(wǎng)頁(yè)內(nèi)容 */
document.body.oncut = function(){return false;}
/** 屏蔽向網(wǎng)頁(yè)粘貼內(nèi)容 */
document.body.onpaste = function(){return false;}
/** 屏蔽拷屏(不停的清空剪貼板) */
window.setInterval('window.clipboardData("Text", "")', 100);
/**
* 屏蔽查看源文件( <body onload=clear()> )
*/
function clear() {
var source=document.body.firstChild.data;
document.open();
document.close();
document.body.innerHTML = source;
}
/**
* 屏蔽js報(bào)錯(cuò)
*/
function KillError()
{
  return true;
}
window.onerror=KillError;

相關(guān)文章

最新評(píng)論