您的位置:首页 > Web前端 > JavaScript

js禁止右键功能键选中内容另存为

2014-03-14 10:02 721 查看
<body>

<script type="text/javascript">
//禁止右键
function stop() {
return false;
}
document.oncontextmenu = stop;

//禁止键盘按键:

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;

</script>

<!-- 禁止选中内容 -->

<script type="text/javascript">

var omitformtags = ["input", "textarea", "select"]

omitformtags = omitformtags.join("|")

function disableselect(e) {

if (omitformtags.indexOf(e.target.tagName.toLowerCase()) == -1)

return false

}

function reEnable() {

return true

}

if (typeof document.onselectstart != "undefined")

document.onselectstart = new Function("return false")

else {

document.onmousedown = disableselect

document.onmouseup = reEnable

}

</script>

<!--禁止网页另存为: -->

<noscript>

<iframe src="/*"></iframe>

</noscript>

这段文字您无法拷贝!

</body>


 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  javascript