<canvas id=”mycanvas” width=”520″ height=”400″ style=”border: 0px solid #000; background-color: #fff;”></canvas>
原创文章,转载请注明来源www.aspbc.com,谢谢
<script>
mycanvas=document.getElementById(“mycanvas”);
ctx = mycanvas.getContext(“2d”);
//画线
ctx.beginPath();
ctx.setLineDash([3, 3]); //画虚线
ctx.moveTo(100,100);
ctx.lineTo(200,100);
ctx.stroke();
ctx.closePath();
</script>