请问,下列下拉菜单为什么不能:当鼠标移开时隐藏?谢谢!


请问,下列下拉菜单为什么不能:当鼠标移开时隐藏?谢谢!

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<SCRIPT language=JavaScript>
<!--
function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}
//-->
</SCRIPT>
</head>

<body bgcolor="#FFFFFF">
<div id="Layer1" style="position:absolute; left:68px; top:28px; width:374px; height:297px; z-index:1"></div>
<div id="Layer2" style="position:absolute; left:88px; top:36px; width:300px; height:25px; z-index:2"> 
  <table width="100%" border="0">
    <tr>
      <td height="28" bgcolor="#FFCCCC">&nbsp;</td>
      <td height="28" bgcolor="#CCFFCC">&nbsp;</td>
    </tr>
  </table>
</div>
<div id="Layer3" style="position:absolute; left:104px; top:41px; width:97px; height:20px; z-index:3"><a href="#" onMouseOver="MM_showHideLayers('Layer5','','show')">dddddd</a></div>
<div id="Layer4" style="position:absolute; left:250px; top:41px; width:104px; height:21px; z-index:4"><a href="#" onMouseOver="MM_showHideLayers('Layer6','','show')">kkkkkk</a></div>
<div id="Layer5" style="position:absolute; left:106px; top:60px; width:94px; height:63px; z-index:5; visibility: hidden"> 
  <table width="100%" border="0">
    <tr>
      <td><a href="#">11111</a></td>
    </tr>
    <tr>
      <td><a href="#">22222</a></td>
    </tr>
    <tr>
      <td><a href="#">33333</a></td>
    </tr>
  </table>
</div>
<div id="Layer6" style="position:absolute; left:250px; top:61px; width:104px; height:82px; z-index:6; visibility: hidden"> 
  <table width="100%" border="0">
    <tr> 
      <td><a href="#">aaaaa</a></td>
    </tr>
    <tr> 
      <td><a href="#">bbbbb</a></td>
    </tr>
    <tr> 
      <td><a href="#">ccccc</a></td>
    </tr>
    <tr>
      <td><a href="#">ddddd</a></td>
    </tr>
  </table>
</div>
</body>
</html>

4 个解决方案

#1


帮你改好了,回去看吧!可以结帖了.
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<SCRIPT language=JavaScript>
<!--

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
//-->
</SCRIPT>
</head>

<body bgcolor="#FFFFFF">
<div id="Layer1" style="position:absolute; left:68px; top:28px; width:374px; height:297px; z-index:1"></div>
<div id="Layer2" style="position:absolute; left:88px; top:36px; width:300px; height:25px; z-index:2"> 
  <table width="100%" border="0">
    <tr>
      <td height="28" bgcolor="#FFCCCC">&nbsp;</td>
      <td height="28" bgcolor="#CCFFCC">&nbsp;</td>
    </tr>
  </table>
</div>
<div id="Layer3" style="position:absolute; left:104px; top:41px; width:97px; height:20px; z-index:3"><a href="#" onMouseOver="MM_showHideLayers('Layer5','','show');MM_showHideLayers('Layer6','','hide')">dddddd</a></div>
<div id="Layer4" style="position:absolute; left:250px; top:41px; width:104px; height:21px; z-index:4"><a href="#" onMouseOver="MM_showHideLayers('Layer6','','show');MM_showHideLayers('Layer5','','hide')">kkkkkk</a></div>
<div id="Layer5" style="position:absolute; left:106px; top:60px; width:94px; height:63px; z-index:5; visibility: hidden" onMouseOut="MM_showHideLayers('Layer5','','hide')" onMouseOver="MM_showHideLayers('Layer5','','show')"> 
  <table width="100%" border="0">
    <tr>
      <td><a href="#">11111</a></td>
    </tr>
    <tr>
      <td><a href="#">22222</a></td>
    </tr>
    <tr>
      <td><a href="#">33333</a></td>
    </tr>
  </table>
</div>
<div id="Layer6" style="position:absolute; left:250px; top:61px; width:104px; height:82px; z-index:6; visibility: hidden" onMouseOut="MM_showHideLayers('Layer6','','hide')" onMouseOver="MM_showHideLayers('Layer6','','show')"> 
  <table width="100%" border="0">
    <tr> 
      <td><a href="#">aaaaa</a></td>
    </tr>
    <tr> 
      <td><a href="#">bbbbb</a></td>
    </tr>
    <tr> 
      <td><a href="#">ccccc</a></td>
    </tr>
    <tr>
      <td><a href="#">ddddd</a></td>
    </tr>
  </table>
</div>
</body>
</html>

#2


呵呵,来晚。。
代码自己没有细看,但自己想应该是没有定义鼠标移开时的行为造成的吧,
好象你的代码行为里只有:"onMouseOver"  而没有"onMouseOut"...
它们的具体作用你可以看看Dreamweaver的帮助文档...

#3


可以结了

#4


谢谢各位大侠:我明白了!
智能推荐

注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
© 2014-2019 ITdaan.com 粤ICP备14056181号  

赞助商广告