canvas显示不了直线???
很简单的代码,可就是运行不出来》》》》求大神解html代码
程序代码:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> <canvas id="fisrtcanvas" width=300 height=200 style="background:rgb(109, 189, 19)">no support</canvas> <script src="1.js"> </script> </body> </html>
js代码
程序代码:
var c = document.getElementById("firstcanvas"); var ctx=c.getContext("2d"); ctx.beginPath(); ctx.moveTo(10,10); ctx.lineTo(20,20); ctx.lineWidth=1.0; ctx.strokeStyle=red; ctx.stroke();