HTML Canvas simple example

<html>
<head>

<script type="text/javascript">

  function draw_rect(x,y) {
    var canvas = document.getElementById("m_canvas");
    if(canvas.getContext) {
      var ctx = canvas.getContext("2d");
      ctx.fillStyle = "rgb(200,0,0)";
      ctx.fillRect(x,y,5,5);
    }
  }

  function onMouseMove(evt) {
    draw_rect(evt.pageX,evt.pageY);
  }

  window.onmousemove = onMouseMove;

</script>


</head>

<canvas id="m_canvas" width="800" height="600">You need a better web browser.</canvas>

</body> 
</html> 
For blog updates and more follow me on twitter.