js+html实现网页自定义右键功能(兼容ie)
版权声明:
本文为博主原创文章,转载请声明原文链接...谢谢。o_0。
更新时间:
2016-05-03 17:31:51
温馨提示:
学无止境,技术类文章有它的时效性,请留意文章更新时间,如发现内容有误请留言指出,防止别人"踩坑",我会及时更新文章
document.oncontextmenu=function(e){
try{
if(window.event) e = window.event;//这一句兼容ie下面获取鼠标坐标
//设置显示菜单的坐标
$('#youmenu').css({left:e.clientX,top:e.clientY});
$('#youmenu').show();
}catch(e){
}
return false; //屏蔽右键
};