日期:2014-05-18 浏览次数:20944 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>JavaScript下拉菜单</title> <style type="text/css"> * { padding:0; margin:0; } body { font-family:verdana, sans-serif; font-size:small; } #navigation, #navigation li ul { list-style-type:none; } #navigation { margin:20px; } #navigation li { float:left; text-align:center; position:relative; } #navigation li a:link, #navigation li a:visited { display:block; text-decoration:none; color:white; width:120px; height:25px; line-height:25px; border:1px solid #fff; border-width:1px 1px 0 0; background:#94964A; padding-left:10px; } #navigation li a:hover { text-decoration:underline; color:yellow; background:#E97D19; } #navigation li ul li a:link,#navigation li ul li a:visited{ color:white; width:180px; height:25px; } #navigation li ul li a:hover { text-decoration:underline; color:yellow; background:#E97D19; } #navigation li ul { display:none; position:absolute; top:25px; left:0; margin-top:1px; } </style> <script type="text/javascript"> function displaySubMenu(li) { var subMenu = li.getElementsByTagName("ul")[0]; subMenu.style.display = "block"; } function hideSubMenu(li) { var subMenu = li.getElementsByTagName("ul")[0]; subMenu.style.display = "none"; } </script> </head> <body> <div style="left:54px; position:absolute; top:71px; height: 60px; width: 700px;"> <ul id="navigation"> <li onmouseover="displaySubMenu(this)" onmouseout="hideSubMenu(this)"> <a href="#">信息查询</a> <ul> <li><a href="#">药品信息</a></li> <li><a href="#">药品采购计划</a></li> <li><a href="#">采购员</a></li> <li><a href="#">供应商</a></li> <li><a href="#">库管员</a></li> </ul> </li> <li onmouseover="displaySubMenu(this)" onmouseout="hideSubMenu(this)"> <a href="#">栏目2</a> <ul> <li><a href="#">栏目2->菜单1</a></li> <li><a href="#">栏目2->菜单2</a></li> <li><a href="#">栏目2->菜单3</a></li> <li><a href="#">栏目2->菜单4</a></li> <li><a href="#">栏目2->菜单5</a></li> </ul> </li> <li onmouseover="displaySubMenu(this)" onmouseout="hideSubM