往上缩的时候,一直在颤动,死活上不去,求指点
<style type="text/css">
body{ margin:0; padding:0;}
#pn{background:#090; width:500px; height:auto; margin:0 auto; text-align:center; display:block;}
.content{width:500px; text-align:center; height:40px; background:#063; padding:10px; margin:0 auto;}
</style>
<script type="text/javascript">
var h=0;
function addh(){
if(h < 300){
h +=5;
document.getElementById("pn").style.height=h+"px";
}
else { }
setTimeout("addh()",30);
}
window.onload=function showads(){
addh();
setTimeout("subh()",5000);
}
function subh(){
if(h>0){
h -=5;
document.getElementById("pn").style.height=h+"px";
}
else{}
setTimeout("subh()",300);
}
</script>