<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="300" height="150" style="border:3px solid #d3d3d3;">Your browser does not support the HTML5 canvas tag.</canvas>
<script type="text/javascript" >
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.strokeStyle="#0000ff"; /*笔触颜色*/
ctx.strokeRect(20,20,200,100); /*笔触开始20,20, 终止坐标20+280,20+130*/
</script>
</body>
</html>
用蓝色笔触绘制一个矩形
最新推荐文章于 2024-09-09 09:35:48 发布