複製代碼代碼如下:
<span style =“ font-size:14px;”> <! doctype html public' - // w3c // dtd xhtml 1.0 transitional // en http://www.w.w.org/xhtml1/xhtml1/dtd/dtd/dtd/xhtml1-transityal.dtdddddddddddddd'>>
<html xmlns =“ http://www.w3.org/1999/xhtml”>
<頭>
<meta http-equiv =“ content-type” content =“ texthtml; charset = utf-8”>
<title>菜單</title>
<style type =“ text/css”>
#nav
{
列表風格:無;
文字平衡:中心;
}
#nav li
{
浮子:左;
寬度:100px;
顏色:白色;
背景色:#3E3E3E;
}
#菜單
{
列表風格:無;
填充:5px;
顯示:無;
左鍵:-5px;
保證金頂:-5px;
}
#Menu li
{
背景色:#ccc;
寬度:100px;
文本平衡:左;
左填充:10px;
}
#Menu li a:鏈接
{
文本介紹:無;
顯示:塊;
}
#Menu li a:懸停
{
背景色:#3E3E3E;
顏色:白色
}
</style>
</head>
<身體>
<ul id =“ nav”>
<li>數數
<ul id =“菜單”>
<li> <a href =“ http://blog.csdn.net/u011043843”> mysql </a> </li>
<li> <a href =“ http://blog.csdn.net/u011043843”> sql Server </a> </li>
<li> <a href =“ http://blog.csdn.net/u011043843”> oracle </a> </li>
<li> <a href =“ http://blog.csdn.net/u011043843”> db2 </a> </li>
</ul>
</li>
<li>前台腳本
<ul id =“菜單”>
<li> <a href =“ http://blog.csdn.net/u011043843”> javascript </a> </li>
<li> <a href =“ http://blog.csdn.net/u011043843”> Ruby </a> </li>
<li> <a href =“ http://blog.csdn.net/u011043843”> html </a> </li>
<li> <a href =“ http://blog.csdn.net/u011043843”> python </a> </li>
</ul>
</li>
<li>後台腳本
<ul id =“菜單”>
<li> <a href =“ http://blog.csdn.net/u011043843”> php </a> </li>
<li> <a href =“ http://blog.csdn.net/u011043843”> asp </a> </li>
<li> <a href =“ http://blog.csdn.net/u011043843”> asp.net </a> </li>
<li> <a href =“ http://blog.csdn.net/u011043843”> jsp </a> </li>
</ul>
</li>
</ul>
<腳本類型=“ text/javascript”>
var lis = document.getElementById(“ nav”)。 getElementsbytagname('li');
var i = 0;
for(i = 0; i <lis.length; i ++)
{
如果(lis [i] .classname ==“ child”)
{
lis [i] .onmouseover = function()
{
var ulobj1 = this.getElementsbytagname('ul')[0];
ulobj1.style.display =“ block”;
this.style.backgroundColor =“#ccc”;
this.style.color =“ black”;
}
}
lis [i] .onmouseout = function()
{
var ulobj1 = this.getElementsbytagname('ul')[0]; //此是htmlelement對象
ulobj1.style.display =“ none”;
this.style.backgroundColor =“#3E3E3E”;
this.style.color =“ white”;
}
}
</script>
</body>
</html> </span>