程序是实现个弹出菜单,当鼠标点击某处时,菜单弹出,当鼠标移开后菜单消失请高手帮我看看该怎么改,或者给个更实用的写法,谢谢!

解决方案 »

  1.   

    <html>
    <head>
    <title>商品信息</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <link rel="stylesheet" href="../css.css" type="text/css">
    </head>
    <script language="JavaScript">
    <!--
    function out1(){
    if (window.event.toElement.id!="menu1"&&window.event.toElement.id!="link1")
    menu1.style.visibility = "hidden";
        }
        function show1(){
         menu1.style.visibility = "visible";
        }
        function out2(){
    if (window.event.toElement.id!="menu2"&&window.event.toElement.id!="link2")
    menu2.style.visibility = "hidden";
        }
        function show2(){
         menu2.style.visibility = "visible";
        }
        function out3(){
    if (window.event.toElement.id!="menu3"&&window.event.toElement.id!="link3")
    menu3.style.visibility = "hidden";
        }
        function show3(){
         menu3.style.visibility = "visible";
        }
        function out4(){
    if (window.event.toElement.id!="menu4"&&window.event.toElement.id!="link4")
    menu4.style.visibility = "hidden";
        }
        function show4(){
         menu4.style.visibility = "visible";
        }
    //-->
    </script>
    <body bgcolor="#CCFFFF" text="#000000">
    <br>
    <b><font color="#FF0000" size="+1">商品信息</font></b><br>
    <br>
    <div id="back1" onmouseout="out1()" style="position:absolute; top:67; left:0;
     height:40; z-index:1; visiblility:visible;">
    <a  href="#" id="menubar" onClick="show1()">
    商品名称</a><br><br>
    <div id="menu1" border="1" style="position:absolute; top:0; left:60;
    width:71; height:60; z-index:2;visibility:hidden;background:brightblue">

    <a id="link1" href="mljx/xxcx.asp" target="right"><font id="link1" color=brightgreen>名称查询</font></a><br>
        
        <a id="link1" href="mljx/xxgx.asp" target="right"><font id="link1" color=brightgreen>名称更新</font></a><br>
        
        <a id="link1" href="mljx/tj.asp" target="right"><font id="link1" color=brightgreen>统计信息</font></a><br>
    </div>    
    </div>

    <div id="back2" onmouseout="out2()" style="position:absolute; top:107; left:0;
     height:40; z-index:1; visiblility:visible;">
    <a  href="#" id="menubar" onClick="show2()">
    商品规格</a><br><br>
    <div id="menu2" border="1" style="position:absolute; top:0; left:60;
    width:95; height:60; z-index:2;visibility:hidden;background:brightblue">
    &nbsp;
    <a id="link2" href="bzw/xxcx.asp" target="right"><font id="link2" color=brightgreen>规格查询</font></a><br>
        &nbsp;
        <a id="link2" href="bzw/xxgx.asp" target="right"><font id="link2" color=brightgreen>规格更新</font></a><br>
        &nbsp;
        <a id="link2" href="bzw/tj.asp" target="right"><font id="link2" color=brightgreen>统计信息</font></a><br>
    </div>    
    </div>
    <div id="back3" onmouseout="out3()" style="position:absolute; top:147; left:0;
     height:40; z-index:1; visiblility:visible;">
    <a  href="#" id="menubar" onClick="show3()">
    供货单位</a><br><br>
    <div id="menu3" border="1" style="position:absolute; top:0; left:60;
    width:95; height:60; z-index:2;visibility:hidden;background:brightblue">
    &nbsp;
    <a id="link3" href="gydh/xxcx.asp" target="right"><font id="link3" color=brightgreen>供货单位查询</font></a><br>
        &nbsp;
        <a id="link3" href="gydh/xxgx.asp" target="right"><font id="link3" color=brightgreen>供货单位更新</font></a><br>
        &nbsp;
        <a id="link3" href="gydh/tj.asp" target="right"><font id="link3" color=brightgreen>统计信息</font></a><br>
    </div>    
    </div> <div id="back4" onmouseout="out4()" style="position:absolute; top:187; left:0;
     height:40; z-index:1; visiblility:visible;">
    <a  href="#" id="menubar" onClick="show4()">
    商品库存</a><br><br>
    <div id="menu4" border="1" style="position:absolute; top:0; left:60;
    width:95; height:60; z-index:2;visibility:hidden;background:brightblue">
    &nbsp;
    <a id="link4" href="ggjt/xxcx.asp" target="right"><font id="link4" color=brightgreen>库存量查询</font></a><br>
        &nbsp;
        <a id="link4" href="ggjt/xxgx.asp" target="right"><font id="link4" color=brightgreen>库存量更新</font></a><br>
        &nbsp;
        <a id="link4" href="ggjt/tj.asp" target="right"><font id="link4" color=brightgreen>统计信息</font></a><br>
    </div>    
    </div>
    </body>
    </html>
    没错阿
      

  2.   

    对阿,程序没有问题呢,按照你说的,功能都能够完成,我想是你浏览器的版本问题吧?
      

  3.   

    谢谢,我的版本是6.0,应该没问题的。
    只是,我在叶面上采用的是框架结构,上面的网页只是框架的一部分。
    会不会是当鼠标移动到别的框架上时就会出现上述问题?
      

  4.   

    没有问题啊!我帮你试了好几次,效果都好啊?是不是你的操作系统有问题呢?
      

  5.   

    我在不同的机子上都试过,确实存在这个问题。
    应该不是我的ie和操作系统的事。
      

  6.   

    它的报错是间歇的,第一次报错可能要等一段时间。
    清朋友们在ie里打开时,多等一会,就会报错的。谢谢。