JavaScript技术:屏蔽网页上的某个功能

1、屏蔽键盘所有键

<script language="javascript">
<!--
function document.onkeydown(){
event.keyCode = 0;
event.returnvalue = false;
}
-->
</script>

2、屏蔽鼠标右键

在body标签里加上 oncontextmenu=self.event.returnvalue=false 或者:

<script language="javascript">
<!--
function document.oncontextmenu()
{
return false;
}
-->
</script>

function nocontextmenu()
{
if(document.all) {
event.cancelBubble=true;
event.returnvalue=false;
return false;
}
}

或者:
<body onmousedown="rclick()" oncontextmenu= "nocontextmenu()">
<script language="javascript">
<!--
function rclick()
{
if(document.all) {
if (event.button == 2){
event.returnvalue=false;
}
}
}
-->
</script>

3、屏蔽F5键

<script language="javascript">
<!--
function document.onkeydown()
{
if ( event.keyCode==116)
{
event.keyCode = 0;
event.cancelBubble = true;
return false;
}
}
-->
</script>

4、屏蔽IE后退按钮,在你链接的时候用
<a href="javascript:location.replace(url)">

5、屏蔽主窗口滚动条
  在body标签里加上
style="overflow-y:hidden"

5、屏蔽拷屏,不断地清空剪贴板
  在body标签里加上
onload="setInterval('clipboardData.setData(\'Text\',\'\')',100)"

6、屏蔽网站的打印功能

<style>
@media print {
* { display: none }
}
</style>

7、屏蔽IE图片上自动出现的保存图标
方法一:
<META HTTP-EQUIV="imagetoolbar" CONTENT="no">

方法二:
<img galleryimg="no">

8、屏蔽页中所有的script
<noscrript></noscript>

This entry was posted in Technology and tagged , . Bookmark the permalink. 5,117 views

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *