标签:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <style> .ab{ position: absolute; width: 1px; height: 1px; border: 0px solid #111; background: #111; } </style> </head> <body> </body> <script> var a=1000,b=500,r=100,divs=null; for(var times=0; times<60; times++) { var hudu = (2*Math.PI/ 360) * 6 * times; var X = a + Math.sin(hudu) * r; var Y = b - Math.cos(hudu) * r;//Math.sin也可以作用y坐标都可以实现圆 看是逆时针还是顺时针 divs=document.createElement("div"); divs.className="ab"; divs.style.cssText='left:'+X+'px;top:'+Y+'px;'; document.body.appendChild(divs); } </script> </html>
标签:
原文地址:http://blog.csdn.net/u011551941/article/details/45696321