HTML5 Canvas使用

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
   <canvas width="400" height="300" id="canvas"></canvas>
   <script type="text/javascript">
       var canvas=document.getElementById("canvas");
       var context= canvas.getContext("2d");
       context.fillStyle="#f00000";
       context.fillRect(0,0,100,100);
   </script>
</body>
</html>

你可能感兴趣的:(HTML5 Canvas使用)