for循环坐标生成《逢五向上转》

<!DOCTYPE html>
<html>
 <head>
  <meta charset="UTF-8">
  <title></title>
  <title></title>
  <style type="text/css">
  div{
   50px;
  height: 50px;
  background-color: red;
  position: absolute;
  top: 0;
  left: 0;
  line-height: 50px;
  text-align: center;
  }
  </style>
  
  <script type="text/javascript">
    window.onload=function (){
  for(var i=0;i<11;i++){
  document.body.innerHTML+='<div>'+i+'</div>';
  }
  var aDiv=document.getElementsByTagName("div");
  for(var j=0;j<6;j++){
  aDiv[j].style.left=j*50+'px';
  aDiv[j].style.top=j*50+'px';
  }
  for(var z=6;z<11;z++){
  aDiv[z].style.left=z*50+'px';
  aDiv[z].style.top=(10-z)*50+'px';
  }
  }
 
</script>
 </head>
 <body>
 </body>
</html>

原文地址:https://www.cnblogs.com/xuling123/p/6902892.html