怎么禁止右键

oncontextmenu="return false" ondragstart="return false" onselectstart="return false"这段加在<body></body>中不管用啊,求指教怎么禁止右键

菜菜0123456
浏览 1648回答 2
2回答

秦磊

<script type="text/javascript">// <![CDATA[function doProhibit(){ if(window.Event)     document.captureEvents(Event.MOUSEUP);   function nocontextmenu() {     event.cancelBubble = true     event.returnvalue = false;     return false; } function norightclick(e) {     if (window.Event)     {        if (e.which == 2 || e.which == 3)        return false;     }     else if (event.button == 2 || event.button == 3)     {   event.cancelBubble = true   event.returnvalue = false;   return false;     } } document.oncontextmenu = nocontextmenu;  // for IE5+ document.onmousedown = norightclick;  // }// ]]></script>

echo_kinchao

你可以用js设置禁用右键
打开App,查看更多内容
随时随地看视频慕课网APP