HTML5画矩形
1、源码
<!doctype html> <html> <head> <meta charset="utf-8"> <title>HTML5画矩形</title> <script> function draw(id) { var canvas = document.getElementById("canvas"); if(canvas == null) { return false; } var context = canvas.getContext("2d"); context.fillStyle = "#FF00000"; context.fillRect(0,0,500,600); for(var i=0;i<10;i++) { context.beginPath(); context.arc(i*25,i*25,i*10,0,Math.PI*2,true); context.closePath(); context.fillStyle = "#00FF00"; context.fill(); } } </script> </head> <body onLoad="draw(‘canvas‘)"> <canvas id="canvas" width="500px" height="600px"></canvas> </body> </html>
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文:http://blog.csdn.net/you23hai45/article/details/49475421