做最好的自己~~

Be My Personal Best!

导航

JS中实现网页中禁止下载图片

 

我把这个网页的代码由贴出来:

 

<html>

<head>
<title> fdsafdsafsda</title>
<script language="javascript">
<!--
function MM()
{
  
if(event.srcElement.id=='an'//判断右击事件发生在哪个对像上面
{
  alert(
"对不起,本图片不能复制,版权所有!")
 document.oncontextmenu
=new Function("event.returnValue=false;");   //禁用右键功能
}
else
{
  document.oncontextmenu
=new Function("event.returnValue=true;");  //启用右键功能

}

-->
</script>
</head>



<body oncontextmenu="MM()">
  
<p><center><img id="an" src="Wallpaper/2_12011134O.jpg"/ width="250px" height="160px"></center> </p>  
</body>

</html>

posted on 2008-12-28 13:27  阿万  阅读(1755)  评论(0编辑  收藏  举报