<html>
<head>
<title>右键菜单</title>
</head>
<body>
<SCRIPT  language=JavaScript1.2> 
//program by jiangzheng3  
//hongceng_3@{域名已经过期}
function shonone() //使关联菜单失效
{
return false;
}
function tt(msg)  //自定义处理函数  msg处理的关键字哦
{
  if(event.button != 2)  //如果不是右键就不处理
     {return false;}
  else
  {  
    aaavm.innerHTML="<a href='" + msg + ".htm'>" + msg + "</a>";
    msgdiv.style.left=event.clientX+20;
    msgdiv.style.top=event.clientY; 
    msgdiv.style.display = "block";
  } 
}
function mnone()  //隐藏菜单
{
 msgdiv.style.display = "none";
}
</script>
<SCRIPT  language=JavaScript1.2> 
if  (document.all  &&  window.print)  { 
document.oncontextmenu  =  shonone; //使关联菜单失效的函数,不可直接用return false;
document.body.onclick  =  mnone;   //隐藏菜单
}
</SCRIPT>
<a href="aa.htm" onMouseDown="tt('aaa')" onClick="return false">不可直接打开链接一</a><br>
<a href="bb.htm" onMouseDown="tt('bbb')" onClick="return false">不可直接打开链接二</a><br>
<a href="cc.htm" onMouseDown="tt('ccc')" onClick="return false">不可直接打开链接三</a><br>
<a href="ee.htm" onMouseDown="tt('eee')">可直接打开链接四</a><br>
<div id="msgdiv" style="position:absolute;display: none">
<div>
<table border="0" cellpadding="1" cellspacing="1" bgcolor="#000000">
<tr bgcolor="#CCCCCC">
   <td>菜单</td>
</tr>
<tr bgcolor="#CCCCCC">
   <td><div id="aaavm"></div></td>
</tr>
<tr bgcolor="#CCCCCC">
   <td>关闭</td>
</tr>
</table>  
</div>
</div>
</body>
</html>
可用于树型菜单,当然这只是最初的.大家可以根据自己的情况改写,实现您的功能.
 






                                账号登录