W3CAPI 实例工具箱
运行代码
源代码
<!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"> </head> <body> <canvas id="myCanvas" width="200" height="100" style="border:1px solid #0D5BB3;"> 您的浏览器不支持HTML5 Canvas标签 </canvas> <script type="text/javascript"> var c=document.getElementById("myCanvas"); var cxt=c.getContext("2d"); cxt.moveTo(10,10); cxt.lineTo(150,50); cxt.lineTo(10,50); cxt.stroke(); </script> </body> </html>
运行结果