<html><head>
<meta charset="utf-8" />
<title></title>
<style>
div{width: 50px;height: 50px;background: darksalmon;font: 12/50 "微软雅黑";
line-height: 50px;position: absolute;text-align:center;} </style></head><body>
<script>
window.onload=function(){ var aDiv=document.getElementsByTagName("div");
for (var i=0;i<30;i++) { document.body.innerHTML+="<div>"+i+"</div>";
} for (var i=0;i<=10;i++) {
aDiv[i].style.top=0;
aDiv[i].style.left=10+i*60+"px";
} for (var i=11;10<i<=20;i++) {
aDiv[i].style.top=60+"px";
aDiv[i].style.left=(10+i*60)-660+"px";
} for (var i=21;20<i<=30;i++) {
aDiv[i].style.top=120+"px";
}
} </script></body></html>
添加回答
举报
0/150
提交
取消