放到HEAD里面了 也加window.onload了还是显示不了 还有用IE9打开不显示。。。。。。
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>顶部广告展开收起</title>
<style>
*{
margin:0;
padding:0;
}
#content{
width:960px;
height:1000px;
background:#ccc;
margin:0 auto;
}
#ad{
width:960px;
margin:0 auto;
display:none;
position:relative;
overflow:hidden;
}
</style>
<script type="text/javascript">
var AD=document.getElementById("ad");
var Adcon=document.getElementById("adcon");
var h=0;
var maxH=Adcon.height;
window.onload=function AdDown(){
if(h<maxH){
h+=5;
AD.style.height=h+'px';
AD.style.display='block';
setTimeout(AdDown,1);
}else{
AD.style.height=h+'px';
AD.style.display='block';
}
}
setTimeout(AdDown,3000);
</script>
</head>
<body>
<div id="ad">
<img id="adcon" src="ad.png" width="960px" height="385px"/>
</div>
<div id="content"><img src="数字商品-10-23.jpg"/></div>
</body>
</html>