首 页 ASP ASP.NET PHP JSP Ajax DIV+CSS JavaScript XML C#
MySQL MSSQL Access Oracle Linux Server 电脑技巧 网络安全 建站经验 其它

一段JS代码解决网页内容无法复制的问题

整理日期:2007年08月22日 【字体:


伊图教程网[www.etoow.com]
http://www.etoow.com/html/2007-08/1187748584.html
(3)另一种屏蔽右键菜单
document.onmousedown=function(){
 if(event.button==2)return false;
}
(4)屏蔽ctrl按键
document.onkeydown=function(){
 if(event.ctrlKey)return false;
}

了解了上述原理,要屏蔽就易如反掌了,呵呵,在浏览器输入如下代码:
javascript:alert(document.onselectstart = document.oncontextmenu = document.onmousedown = document.onkeydown = function(){return true;});
实际中发现如果不用alert语句套上,会导致浏览器重写当前窗口,于是就加上了。大家不妨试试,遇到不奏效的记得反馈下,我好研究是否有更完善的方案。

相比而言,这比查看源代码,或者屏蔽浏览器的javascript功能都方便多了,大家都来感谢偶吧!
Tags:
一段JS代码解决网页内容无法复制的问题
'http://www.etoow.com/html/2007-08/1187748584.html
1
 
信息搜索
  
联系我们关于本站广告服务设为首页 收藏本站友情链接网站地图
Copyright © Etoow.com Inc. All Rights Reserved