如何在页面中禁用鼠标右键
2018-03-18 20:40
211 查看
今天意外到了一个外国的网站,这个网站虽然设计的不怎么样,但是他既然不能够按下这个鼠标右键,引起了我的好奇。
所有我就研究了一下,想与大家一起分享var message="Right Click Function Disabled on this Page!"; //按下右键时,所要提示的信息
function clickIE4()
{
}
所有我就研究了一下,想与大家一起分享var message="Right Click Function Disabled on this Page!"; //按下右键时,所要提示的信息
function clickIE4()
{
//event.button 是用来监视鼠标事件if (event.button==2) { //1 表示鼠标左键 4 表示鼠标中键 2 表示鼠标右键
alert(message); return false;
} } function clickNS4(e) //非ie浏览器 { if (document.layers||document.getElementById&&!document.all) { //非ie浏览器 e.keycode == e.which //非ie浏览器的鼠标事件为 0为左键 1为中键 2为右键 if (e.which==2||e.which==1) { alert(message); return false; } } } if (document.layers) { document.captureEvents(Event.MOUSEDOWN); document.onmousedown=clickNS4; } else if (document.all&&!document.getElementById) { document.onmousedown=clickIE4; } //此函数为内置函数,来禁用鼠标右键 document.oncontextmenu=new Function("alert(message);return false")
}
相关文章推荐
- js如何禁用鼠标右键
- 如何在HTML页面屏蔽鼠标右键和F5刷新键?
- 如果浏览的页面中应用了java脚本禁用了鼠标右键,解决的方法
- 如何让web页面鼠标右键单击之后不出现菜单选项
- 页面js禁用鼠标右键
- aspx页面禁用鼠标右键
- Javascript如何禁止F5刷新页面和鼠标右键刷新页面?
- 转载:收藏:如何禁用鼠标右键拖动复制文字等
- 页面禁用 鼠标右键
- 在页面中 禁用 复制 (鼠标右键 和 Ctrl + C)
- javascript实现加载页面全屏以及禁用鼠标右键和选取功能
- js禁用当前页面鼠标右键
- 教你如何巧妙破除网页鼠标右键禁用的十大绝招
- 如何禁用HTML页面的上下文菜单
- 通过注册表禁用桌面鼠标右键等
- 如何获取页面上鼠标选中的文字
- 破解网页鼠标右键被禁用的最新方法
- 如何自定义更改鼠标右键...
- Win7如何自定义鼠标右键菜单 添加新建EXCEL文档
- JQuery中判断checkbox是否选中与禁用鼠标右键