javaScript+DIV+CSS實現下拉式功能表

來源:互聯網
上載者:User

<html>
<head>
<title>下拉式功能表樣本</title>
<script language="javascript">
function show(menu){
    document.getElementById(menu).style.visibility="visible";
}
function hide(){
document.getElementById("menu1").style.visibility="hidden";
document.getElementById("menu2").style.visibility="hidden";
document.getElementById("menu3").style.visibility="hidden";
}
</script>
</head>

<body>
<table>
<tr bgcolor="#999ff">
<td width="80" onMouseMove="show('menu1')" onMouseOut="hide()">菜單一</td>
<td width="80" onMouseMove="show('menu2')" onMouseOut="hide()">菜單二</td>
<td width="80" onMouseMove="show('menu3')" onMouseOut="hide()">菜單三</td>
</tr>
</table>
<div id="menu1" onMouseMove="show('menu1')" onMouseOut="hide()" style="background-color:#00FF00; position:absolute; left=12;top=38;width=80;visibility=hidden;">
<span>子功能表一</span><br />
<span>子功能表二</span><br />
<span>子功能表三</span><br />
</div>

<div id="menu2" onMouseMove="show('menu2')" onMouseOut="hide()" style="background-color:#9999ff; position:absolute; left=95;top=38;width=80; visibility=hidden;">
<span>子功能表一</span><br />
<span>子功能表二</span><br />
<span>子功能表三</span><br />
</div>

<div id="menu3" onMouseMove="show('menu3')" onMouseOut="hide()" style="background-color:#FF0000; position:absolute; left=180;top=38;width=80; visibility=hidden;">
<span>子功能表一</span><br />
<span>子功能表二</span><br />
<span>子功能表三</span><br />
</div>

</body>
</html>

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.