js高来帮我看看!这段代码...,是一个右键菜单... 还有个问题就是,在一个div内部,怎么屏蔽浏览器右键 5
然后绑定一个事件,显示自己定义的菜单,现在已经完成到了,鼠标右键显示自定义菜单,但是浏览器菜单也显示了,怎么解决?<script>window.onload=functi...
然后绑定一个事件,显示自己定义的菜单,现在已经完成到了,鼠标右键显示自定义菜单,但是浏览器菜单也显示了,怎么解决?
<script>
window.onload = function() {
var container = document.getElementById('container');
var menu = document.getElementById('menu');
/*显示菜单*/
function showMenu() {
var evt = window.event || arguments[0];
var rightedge = container.clientWidth-evt.clientX;
var bottomedge = container.clientHeight-evt.clientY;
menu.style.top = container.scrollTop + evt.clientY + "px";
menu.style.visibility = "visible";
}
/*隐藏菜单*/
function hideMenu() {
menu.style.visibility = 'hidden';
} //这几句干嘛的?
LTEvent.addListener(container,"contextmenu",LTEvent.cancelBubble);
LTEvent.addListener(container,"contextmenu",showMenu);
LTEvent.addListener(document,"click",hideMenu);
}
</script> 展开
<script>
window.onload = function() {
var container = document.getElementById('container');
var menu = document.getElementById('menu');
/*显示菜单*/
function showMenu() {
var evt = window.event || arguments[0];
var rightedge = container.clientWidth-evt.clientX;
var bottomedge = container.clientHeight-evt.clientY;
menu.style.top = container.scrollTop + evt.clientY + "px";
menu.style.visibility = "visible";
}
/*隐藏菜单*/
function hideMenu() {
menu.style.visibility = 'hidden';
} //这几句干嘛的?
LTEvent.addListener(container,"contextmenu",LTEvent.cancelBubble);
LTEvent.addListener(container,"contextmenu",showMenu);
LTEvent.addListener(document,"click",hideMenu);
}
</script> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询