可以展开,就是不可以收回,看了n多遍没看出哪出错了
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无解</title>
<style type="text/css">
*{
margin: 0 auto;
padding: 0;
}
#move{
width: 1000px;
height: auto;
overflow: hidden;
background-color: hotpink;
display: block;
margin: 0 auto;
}
.moke{
width: 1000px;
height: 50px;
line-height: 50px;
text-align: center;
font-size: 20px;
background-color: orchid;
}
</style>
<script type="text/javascript">
var h=0;
function addh(){
if(h<300){
h+=5;
document.getElementById("move").style.height=h+"px";
}
else{
return;
}
setTimeout(addh,30);
}
window.onload=function(){
addh();
setTiomeout(subH,5000);
}
function subh(){
if(h>0){
h-=5;
document.getElementById("move").style.height=h+"px";
}
else{
return;
document.getElementById("move").style.display="none";
}
setTimeout(subh,30);
}
</script>
</head>
<body>
<div id="move">
<h1> 好好学习天天向上</h1>
</div>
<div class="moke">好喜欢学习,才怪</div>
</body>
</html>