HTML Canvas simple example


<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)";

  function onMouseMove(evt) {

  window.onmousemove = onMouseMove;



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


Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>