JavaScript小贴士---在浏览器中隐藏右键菜单

JavaScript小贴士

---在浏览器中隐藏右键菜单

方法一:

<html>

<head>

<script language="javascript">

function hidecontextmenu()

{

return false;

}

</script>

</head>

<body oncontextmenu="return hidecontextmenu()">

</body>

</html>

方法二:

<html>

<head>

<script language="javascript">

<!--为事件处理程序代码编写一个函数 -->

<!--

function hideContextmenu()

{

window.event.returnValue = false;

}

//-->

</script>

</head>

<!-- 将这个函数与对应的事件相关联 -->

<body oncontextmenu="hideContextmenu()">

</body>

</html>

方法三:

<html>

<head>

<script language="javascript">

       document.oncontextmenu = hideContextMenu;

       function hideContextMenu()

       {

        window.event.returnValue = false;

       }

</script>

</head>

<body>

</body>

</html>

方法四:

<html>

<head>

</head>

<script language="javascript" for="document" event="oncontextmenu">

       window.event.returnValue=false;

</script>

<body>

</body>

</html>

 

posted on 2006-04-16 11:33  有激情更开心  阅读(636)  评论(0编辑  收藏  举报

导航