防止页面内容的复制、选取和右键屏蔽

通过下面的代码,即可实现页面全屏蔽功能:

<DIV id=divTitle style="FONT-SIZE: 16px">禁止复制代码1</DIV>
<SCRIPT LANGUAGE=javascript>
function click() {
alert('禁止你的左键复制!') }
function click1() {
if (event.button==2) {alert('禁止右键点击~!') }}
function CtrlKeyDown(){
if (event.ctrlKey) {alert('不当的拷贝将损害您的系统!') }}
document.οnkeydοwn=CtrlKeyDown;
document.onselectstart=click;
document.οnmοusedοwn=click1;
</SCRIPT>



<SCRIPT language=javascript></SCRIPT>
<DIV id=divTitle style="FONT-SIZE: 16px">禁止复制代码2</DIV>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; οnresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>
<body leftmargin=0 topmargin=0 οnmοusemοve='HideMenu()' οncοntextmenu="return false" οndragstart="return false" onselectstart ="return false" οnselect="document.selection.empty()" οncοpy="document.selection.empty()" onbeforecopy="return false" οnmοuseup="document.selection.empty()">
<noscript><iframe src=*></iframe></noscript>

// 彻底屏蔽右键菜单
document.oncontextmenu = function()
{
window.event.returnvalue=false;
alert("对话框内容");
return false;
}

或者:
在<body>中加入以下代码: 效果等价(我感觉还是加下面的好,多容易啊)
<body οnmοusemοve=/HideMenu()/ οncοntextmenu="return false" οndragstart="return false" onselectstart ="return false" οnselect="document.selection.empty()" οncοpy="document.selection.empty()" onbeforecopy="return false" οnmοuseup="document.selection.empty()"> 
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值