如题 我发现打开网页后  下拉菜单就出现了 只有在鼠标放上去并移开后下拉菜单才会消失 
怎样改代码 使得一打开网页就看不到隐藏的下拉菜单呢?? 先谢谢各位了<html>
<head>
<title>
用层做的下拉菜单
</title>
<style>
div.a
{
position:absolute;
top:20;
left:20;
width:100;
background-color:yellow;
}
div.b
{
position:absolute;
top:20;
left:120;
width:100;
background-color:blue;
}
div.c
{
position:absolute;
top:20;
left:220;
width:100;
background-color:green;
}
</style>
</head>
<body>
<div class=a>
<table border=1 width=100 cellspacing=0 cellpadding=0>
<tr>
<td onmouseover="app()" onmouseout="hid()" >
a<div id=menu>
<table border=1 width=100 cellspacing=0 cellpadding=0>
<tr>
<td bgcolor=green>
a1
</td>
</tr>
<tr>
<td>
a2
</td>
</tr>
<tr>
<td>
a3
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</div>
<div class=b>
<table border=1 width=100 cellspacing=0 cellpadding=0>
<tr>
<td>
b
</td>
</tr>
</table>
</div>
<div class=c>
<table border=1 width=100 cellspacing=0 cellpadding=0>
<tr>
<td>
c
</td>
</tr>
</table>
</div>
<script>
function app(){menu.style.display="block"}
function hid(){menu.style.display="none"}
</script>
</body>
</html>

解决方案 »

  1.   


    <html>
    <head>
    <title>
    用层做的下拉菜单
    </title>
    <style>
    div.a
    {
    position:absolute;
    top:20;
    left:20;
    width:100;
    background-color:yellow;
    }
    div.b
    {
    position:absolute;
    top:20;
    left:120;
    width:100;
    background-color:blue;
    }
    div.c
    {
    position:absolute;
    top:20;
    left:220;
    width:100;
    background-color:green;
    }
    </style>
    </head>
    <body>
    <div class=a>
    <table border=1 width=100 cellspacing=0 cellpadding=0>
    <tr>
    <td onmouseover="app()" onmouseout="hid()" >
    a<div id=menu style="display:none">
    <table border=1 width=100 cellspacing=0 cellpadding=0>
    <tr>
    <td bgcolor=green>
    a1
    </td>
    </tr>
    <tr>
    <td>
    a2
    </td>
    </tr>
    <tr>
    <td>
    a3
    </td>
    </tr>
    </table>
    </div>
    </td>
    </tr>
    </table>
    </div>
    </div>
    <div class=b>
    <table border=1 width=100 cellspacing=0 cellpadding=0>
    <tr>
    <td>
    b
    </td>
    </tr>
    </table>
    </div>
    <div class=c>
    <table border=1 width=100 cellspacing=0 cellpadding=0>
    <tr>
    <td>
    c
    </td>
    </tr>
    </table>
    </div>
    <script>
    function app(){menu.style.display="block"}
    function hid(){menu.style.display="none"}
    </script>
    </body>
    </html>
      

  2.   

    window.onload=function(){
    hid();
    };
      

  3.   

    在 body onload 事件中加 hid()