<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>
<!-- 禁用右键: -->
<script>
function stop(){
return false
}
document.oncontextmenu=stop
</script>
功能:禁止右键、禁选择、禁粘贴、禁shift、禁ctrl、禁alt
<script language="JavaScript">
<!--
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
if (window.Event)
document.captureEvents(Event.MOUSEUP)
function nocontextmenu(){
event.cancelBubble = true
event.returnValue = false
return false}
function norightclick(e){
if (window.Event){
if (e.which == 2 || e.which == 3)
return false}
else
if (event.button == 2 || event.button == 3){
event.cancelBubble = true
event.returnValue = false
return false}
}
//禁右键
document.oncontextmenu = nocontextmenu // for IE5+
document.onmousedown = norightclick // for all others
//-->
</script>
<body onselectstart="return false"onpaste="return false">
可以通过禁用浏览器的js功能来解除网页禁止粘贴,这里以谷歌浏览器为例。
1、同时按住键盘上的“Ctrl”键+“Shift”键+“Del”键打开谷歌浏览器的设置,然后点击页面底部的“高级”按钮:
2、点击“高级”按钮之后,在弹出的窗口中向下拉动,然后点击“网站设置”按钮:
3、在网站设置中找到“JavaScript”这一项,然后点击一项的按钮:
4、在弹出的页面中将JavaScript关闭,这时就解除了网页的禁止粘贴了: