大家看看我的修改的一个关于右键菜单的程序,特别是,meizz(梅花雨) 上面例子我有两个问题:1。在击右键菜单时,window的菜单也出现,怎么禁止?2。现在我想把down(tid,gid)中参数传到添加子组、删除改组和修改组等这些连接中,问怎么传递参数?急盼解 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://go6.163.com/colorweb/xml/xmlcontextmenu.html <!-- 时间较紧,改得仓促! --><html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><style>td {font-size: 13px}.menu1 {cursor: default}</style><script language=Javascript>var menuclass,menutitle;function document.onmouseover(){ menuclass = window.event.toElement.className; menutitle = window.event.toElement.innerText; //得到鼠标当前所对应的文字,以便判断是否弹出菜单 }function document.onmousedown(){ var x = window.event.clientX; var y = window.event.clientY; var x0=document.body.clientWidth; var y0=document.body.clientHeight; if(event.button==2 && (menutitle=="连接一" || menutitle=="连接二")){ ie5menu.style.display=""; var x1=document.all.ie5menu.clientWidth; var y1=document.all.ie5menu.clientHeight; ie5menu.style.left = (x0-x-4<x1) ? x-x1-4 : x+2; ie5menu.style.top = (y0-y<y1) ? y-y1-4 : y; //这种位置设置法的好处在于碰到不够宽的时候菜单会真实window菜单一样移位 } if(event.button==1 && menuclass != "menu1") ie5menu.style.display = "none";}function jumptoie5(){ if (event.srcElement.className=="menu1"){ if (event.srcElement.getAttribute("target")!=null) window.open(event.srcElement.url,event.srcElement.getAttribute("target")) else window.location=event.srcElement.url } ie5menu.style.display = "none"; }function mo(tt,st){ //当鼠标经过时会变到的底色与文字颜色 if (tt=="over"){st.background='highlight';st.color='#FFFFFF';} else {st.background='menu'; st.color='#000000';} }</SCRIPT></head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 oncontextmenu="window.event.returnValue=false;//取消鼠标右键菜单" onkeydown="if(event.keyCode==27)document.all.ie5menu.style.display='none';//ESC键隐藏菜单"><br><br><br><br> <a href="http://www.sina.com.cn">连接一</a><br><br> <a href="http://www.163.com">连接二</a><DIV id=ie5menu style="BACKGROUND: menu; border: 2 outset #FFFFFF;z-index: 12; position: absolute; display: none" onclick="jumptoie5()"><table border=0 cellspacing=2 cellpadding=1><tr><td noWrap class=menu1 onmouseover=mo("over",this.style) onmouseout=mo("out",this.style) url="addGroup.htm" target="main"> 添加子组 </td></tr><tr><td noWrap class=menu1 onmouseover=mo("over",this.style) onmouseout=mo("out",this.style) url="delGroup.jsp" target="main"> 修改该组</td></tr><tr><td noWrap class=menu1 onmouseover=mo("over",this.style) onmouseout=mo("out",this.style) url="#"> 删除该组</td></tr></table></div></body></html> 谢谢meizz(梅花雨)!不过我可能还有问题,先结贴再说吧 extjs中的stackedcolumnchart颜色块出现重叠 jquery+ajax切换问题 获取body下的文本节点,两种方法有何不同? VS2008中的智能弹出有说明吗? 如何在js函数里改变html页面上的控件的标题阿 找个技术伙伴北京做网站创业 小规模做起 用威客做社区 能否给一个用showModalDialog打开窗口,用window.returnValue返回值的例子? 求助:js问题 如何有效拆分类如"1_2_20_30_"的字符串 jscript里session判断的语句怎么写 如何让iframe刷新的问题 如何在javascript里面把<input>属性设为只读,?
<html><head><title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
td {font-size: 13px}
.menu1 {cursor: default}
</style>
<script language=Javascript>
var menuclass,menutitle;
function document.onmouseover(){
menuclass = window.event.toElement.className;
menutitle = window.event.toElement.innerText; //得到鼠标当前所对应的文字,以便判断是否弹出菜单
}
function document.onmousedown(){
var x = window.event.clientX;
var y = window.event.clientY;
var x0=document.body.clientWidth;
var y0=document.body.clientHeight; if(event.button==2 && (menutitle=="连接一" || menutitle=="连接二")){
ie5menu.style.display="";
var x1=document.all.ie5menu.clientWidth;
var y1=document.all.ie5menu.clientHeight;
ie5menu.style.left = (x0-x-4<x1) ? x-x1-4 : x+2;
ie5menu.style.top = (y0-y<y1) ? y-y1-4 : y;
//这种位置设置法的好处在于碰到不够宽的时候菜单会真实window菜单一样移位
}
if(event.button==1 && menuclass != "menu1") ie5menu.style.display = "none";
}function jumptoie5(){
if (event.srcElement.className=="menu1"){
if (event.srcElement.getAttribute("target")!=null)
window.open(event.srcElement.url,event.srcElement.getAttribute("target"))
else
window.location=event.srcElement.url
}
ie5menu.style.display = "none";
}function mo(tt,st){ //当鼠标经过时会变到的底色与文字颜色
if (tt=="over"){st.background='highlight';st.color='#FFFFFF';}
else {st.background='menu'; st.color='#000000';}
}
</SCRIPT>
</head>
<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 oncontextmenu="window.event.returnValue=false;//取消鼠标右键菜单"
onkeydown="if(event.keyCode==27)document.all.ie5menu.style.display='none';//ESC键隐藏菜单">
<br><br><br><br>
<a href="http://www.sina.com.cn">连接一</a><br><br>
<a href="http://www.163.com">连接二</a><DIV id=ie5menu style="BACKGROUND: menu; border: 2 outset #FFFFFF;z-index: 12; position: absolute; display: none" onclick="jumptoie5()">
<table border=0 cellspacing=2 cellpadding=1>
<tr><td noWrap class=menu1 onmouseover=mo("over",this.style) onmouseout=mo("out",this.style) url="addGroup.htm" target="main"> 添加子组 </td></tr>
<tr><td noWrap class=menu1 onmouseover=mo("over",this.style) onmouseout=mo("out",this.style) url="delGroup.jsp" target="main"> 修改该组</td></tr>
<tr><td noWrap class=menu1 onmouseover=mo("over",this.style) onmouseout=mo("out",this.style) url="#"> 删除该组</td></tr>
</table></div></body>
</html>