canvas最简程序

<html>
<head>
    <script>
    window.onload = function(){
        var canvas = document.getElementById("cc");
        var context = canvas.getContext("2d");
        context.fillStyle = "red";
        context.fillRect(0, 0, 1000, 1000);
        context.fillStyle = "black";
        context.fillRect(10,10,100,100);
    }
    </script>
</head>
<body>
    <canvas id="cc" width=300 height=300></canvas>
</body>
</html>

 

posted @ 2013-05-08 13:27  fff8965  阅读(145)  评论(0编辑  收藏  举报