<!DOCTYPE html> <html> <head> <title>first page</title> </head> <body> <!--定义一个canvas--> <canvas id="mycanvas" width="200" height="200"></canvas> </body> <script type="text/javascript"> var myc = document.getElementById("mycanvas"); <!--创建context对象--> var hb = mycanvas.getContext("2d"); hb.fillStyle = "#bebebe"; hb.fillRect(0,0,10,750); </script> </html>
调试截图:
时间: 2024-10-09 20:16:15