如何隐藏一些属性在右键单击使用JS

How to hide some property in Right click using JS

本文关键字:右键 单击 JS 属性 何隐藏 隐藏      更新时间:2023-09-26

我的web应用程序,我想隐藏/删除一些菜单,如查看源,属性使用JavaScript编码。这应该在整个网页中可用。

不做。

你只会让你的用户生气,但你无法阻止他们。

参见我如何禁用右键单击我的网页?

如果我不能阻止你做这件事。你只能禁用整个菜单:
<script language="javascript">
document.onmousedown=disableclick;
Function disableclick(e)
{
  if(event.button==2)
   {
     return false;    
   }
}
</script>
var message="Sorry, right-click has been disabled"; 
function clickIE() {if (document.all) {(message);return false;}} 
function clickNS(e) {
   if(document.layers||(document.getElementById&&!document.all)) { 
       if (e.which==2||e.which==3) {(message);return false;}}} 
       if (document.layers){
          document.captureEvents(Event.MOUSEDOWN);
          document.onmousedown=clickNS;
       } 
       else{
          document.onmouseup=clickNS;
          document.oncontextmenu=clickIE;
       } 
document.oncontextmenu=new Function("return false") 

是禁用右键的代码