利用JS代码禁止用户复制网页内容
第一种禁止用户复制内容的方法,在网页的body标签中添加
onmouseup=document.selection.empty() oncontextmenu="return false" onselectstart="return false" ondragstart="return false" onbeforecopy="return false" oncopy=document.selection.empty()
此行即可,不过用户若禁用JS或查看源代码的话,还是可以复制文件内容,因此本方法只可对付一些对电脑不太了解的访客。
提示:您可以先修改部分代码再运行,保存代码功能在Firefox下无效。
<html> <head> <title>禁止用户复制网页内容(方法二)- 小辞博客</title> </head> <body onmouseup=document.selection.empty() oncontextmenu="return false" onselectstart="return false" ondragstart="return false" onbeforecopy="return false" oncopy=document.selection.empty()><table width="782" height="532" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="594" height="165"> </td> <td width="188" height="165"> </td> </tr> <tr> <td height="367" align="left" valign="top" style="text-indent:5px; font-size:12px">1 、免费提交加盟申请; <p>2 、加盟申请通过公司审核后,加盟商会收到“ 金宝宝特许经营合同 ”,并与公司签订合同 ;</p> <p>3 、加盟商缴纳保证金;</p> <p>4 、加盟商汇首批进货款,公司收到首批进货款后发货;</p> <p>5 、加盟商收货验货;</p> <p>6 、加盟店正式营业。</p> <p> </p></td><td height="367"> </td> </tr> </table> </body> </html>
转载请注明出处: 小辞博客
本文的链接地址: https://www.9sdz.com/?post=25
下一篇
给网站添加鼠标点击弹出爱心效果
您可能对以下文章感兴趣
发表评论
取消回复