2 回答
已采纳
kofzxaaa
TA贡献66条经验 获得超26个赞
<!DOCTYPE html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <canvas id="canvas"></canvas> <script> var can = document.getElementById("canvas"); var c = can.getContext('2d'); c.beginPath(); c.moveTo(50,50); c.lineTo(50,100); c.stroke(); c.closePath(); </script> </body> </html>
记得把script标签放在body的最后就行了。
添加回答
举报
0/150
提交
取消