屏蔽右击事件

方法一:

 document.onmousedown = noSourceExplorer;
        function noSourceExplorer()
        {
        if (event.button == 2 | event.button == 3)
        {
           alert("想作弊??不让你看");
        }

        }

 

这种写法有弊端,点击中键以后再点右键就不受约束,why??

 应该于 <body oncontextmenu="window.event.returnValue=false">

配合使用。

posted @ 2009-01-05 16:13  Rangerling  阅读(227)  评论(0编辑  收藏  举报