标签:
1. Canvas画布 通常用js来描绘
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>Canvas</title> <script src="myjavascript.js"></script> </head> <body> </body> </html>
var CANVAS_WIDTH = 200; var CANVAS_HEIGHT = 200; var myCanvas; var myContext; window.onload = function () { createCanvas(); drawRect(); } function createCanvas(){ document.body.innerHTML = "<canvas id=\"mycanvas\" width=\"" + CANVAS_WIDTH + "\" height=\"" + CANVAS_HEIGHT + "\" ></canvas>"; myCanvas = document.getElementById("mycanvas"); myContext = myCanvas.getContext("2d"); } function drawRect(){ myContext.fillRect(0,0,200,200); }
标签:
原文地址:http://www.cnblogs.com/iMirror/p/4290501.html