最简单的所有都屏蔽右键菜单
代码如下
<script type="text/javascript">
documentbodyoncontextmenu=new function(){return false;};
</script>
我们希望在INPUTtextTEXTAREA中可以实现右击但在其它页面都要屏蔽右键菜单
实例代码
代码如下
<script type="text/javascript">
//屏蔽右键菜单
documentoncontextmenu = function (event){
if(windowevent){
event = windowevent;
}try{
var the = eventsrcElement;
if (!((thetagName == "INPUT" && thetypetoLowerCase() == "text") || thetagName == "TEXTAREA")){
return false;
}
return true;
}catch (e){
return false;
}
}
</script>