一个大div套一个小div,让小div向上移动,实现动画效果,结果报错,大牛们看看。
一个大div套一个小div,让小div向上移动,实现动画效果,结果报错,大牛们看看。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<style type="text/css">
#f{width:200px;height:200px;border:1px solid;margin-top:120px;}
#s{width:100px;height:100px;border:1px solid;margin-top:0px;}
</style>
</head>
<body>
<div id="f">
<div id="s">
32132
</div>
</div>
<script type="text/javascript">
var s=document.getElementById("s");
var st=parseInt(s.style.marginTop);
function mo( ){
st-=10;
s.style.marginTop=st+"px";
}
setInterval("mo( )",1000);
</script>
</body>
</html>