都照着写,为什么还是没有效果,问题出在哪了
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
*{
margin:0;
padding:0;
}
.container{
margin:0 auto;
width:400px;
}
li{
list-style:none;
float:left;
width:90px;
line-height:34px;
text-align:center;
background:#CCC;
margin-right:1px;
}
a{
text-decoration:none;
color:#000;
font-weight:bold;
display:block;
}
.nav li ul{
block:none;
position:absolute;
height:0;
overflow:hidden;
}
.nav_pic{
display:block;
height:11px;
background:url(bird.png) 31px no-repeat;
}
.nav li a:hover{
background:url(slide-pannel_14.png) repeat-x;
color:#fff;
}
.nav_first{
background:url(slide-pannel_14.png) repeat-x;
}
</style>
<script type="text/javascript">
window.onload=function(){
var lis=document.getElementsByTagName("li");
for(var i=0;i<lis.length;i++){
lis[i].onmouseover=function(){
var u=this.getElementsByTagName("ul")[0];
u.style.display="block"
addH(u.id);
}
lis[i].onmouseleave=function(){
var u=this.getElementsByTagName("ul")[0];
subH(u.id);
}
}
}
function addH(id){
var ulLis=document.getElementById("id")[0];
var h=ulLis.offsetHeight;
h+=1;
if(h<45){
ulLis.style.height=h+"px";
setTimeout(" addH(' "+id+" ')",10);
}
else{
return;
}
}
function subH(id){
var ulLis=document.getElementById("id")[0];
var h=ulLis.offsetHeight;
h-=1;
if(h>0){
ulLis.style.display="none";
setTimeout(" subH(' "+id+" ')",10);
}
else{
return;
}
}
</script>
</head>
<body>
<div class="container">
<ul class="nav">
<li class="nav_first"><a href="#">首页</a></li>
<li><a href="#">课程大厅</a>
<ul class="munUl">
<span class="nav_pic"></span>
<li><a href="#">javascript</a></li>
<li><a href="#">jQuery</a></li>
<li><a href="#">css</a></li>
</ul>
</li>
<li><a href="#">学习我们</a></li>
<li><a href="#">联系我们</a></li>
</ul>
</div>
</body>
</html>