canvas

<html><head>
  <title>canvas</title>
   <script type="text/javascript">
      function draw() {
        var canvas = document.getElementById('tutorial');
        if (canvas.getContext){
            var context = canvas.getContext('2d');
            context.fillRect(25, 25, 150, 150);
            context.clearRect(45, 45, 90, 90);
            context.strokeRect(50, 50, 50, 50);
        }
      }
    </script>

</head>
<body onload="draw()">

    <canvas style="border: 1px solid black;" 
            id="tutorial" 
            width="150" height="150"></canvas>

</body>
</html>
View in Browser
Previous | Next | Top | Cafe con Leche

Copyright 2007 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified March 12, 2007