当前位置: 首页 > 图文教程 > 网络编程 > Javascript > javascript 禁止复制网页

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript 中的 javascript 禁止复制网页


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 81 ::
收藏到网摘: n/a

常见的一些禁止复制网页的代码,但破解方法也不见容易,这里就不说了,可以看本站以前发布的文章。 1、使右键和复制失效
方法1:
在网页中加入以下代码:
<script language="Javascript">
document.oncontextmenu=new Function("event.returnValue=false");
document.onselectstart=new Function("event.returnValue=false");
</script>
方法2:
在<body>中加入以下代码:
<body oncontextmenu="return false" onselectstart="return false">

<body oncontextmenu="event.returnValue=false" onselectstart="event.returnValue=false">
实质上,方法2与方法1是一样的。
方法3:
如果只限制复制,可以在<body>加入以下代码:
<body oncopy="alert('对不起,禁止复制!');return false;">
2、使菜单"文件"-"另存为"失效
如果只是禁止了右键和选择复制,别人还可以通过浏览器菜单中的"文件"-"另存为"拷贝文件。为了使拷贝失效,可以在<body>与</body>之间加入以下代码:
<noscript>
<iframe src="*.htm"></iframe>
</noscript>
这样,用户在另存网页时,就会出现"无法保存Web页"的错误。