回复 楼主 carsontu
不好意思,之前的代码摘错了。删了重贴在下面:
<p>
<canvas id="myCanvas" width="520" height="520" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.
</canvas>
<script>
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
var bakgrd=new Image();
bakgrd.src="Images/wood1.jpg";
bakgrd.onload=function(){
ctx.drawImage(bakgrd,0,0);
}
ctx.stroke();
</script>
<script>
ctx.beginPath();
for(var i=0; i<19; i++) {
ctx.moveTo(20+i*30,20);
ctx.lineTo(20+i*30,500);
ctx.moveTo(20,20+i*30);
ctx.lineTo(500,20+i*30);
}
ctx.stroke();
</script>
[
本帖最后由 carsontu 于 2015-8-9 16:57 编辑 ]