1、屏蔽浏览器右击事件
2、写事件

<p id="test" oncontextmenu="myFunction()" class="tips">咦~,没有找到任何记录,可以选择下面的功能</p>
<script>
<script>
document.getElementById("test").oncontextmenu = function(event) {
document.getElementById('example').style.display = "block";
if (document.all) window.event.returnValue = false; // for IE
else event.preventDefault(); //for firefox
}
</script>
</script>
3、参考网站
http://blog.chinaunix.net/uid-20556344-id-1926261.html
http://www.w3school.com.cn/tags/html_ref_eventattributes.asp
http://www.w3school.com.cn/jsref/event_button.asp
网友评论