text: <script type="text/javascript">
  var shape;
  var color;
  function myClickEvent(e){
          var ctx = c.getContext("2d");
          ctx.beginPath();
          if(color==1){
              ctx.strokeStyle='red';
          }else if(color==2){
              ctx.strokeStyle='yellow';
          }else if(color==3){
              ctx.strokeStyle='blue';
          }
          if(shape == 0){
              ctx.arc(e.offsetX,e.offsetY, 45, 0, 2 * Math.PI);
              ctx.stroke();
              
          }else if(shape == 1){
  
              ctx.moveTo(75, 50);
              ctx.lineTo(75, 100);
              ctx.lineTo(50, 100);
              ctx.closePath();
              ctx.stroke();
          }else if(shape==2){
              ctx.rect(e.offsetX,e.offsetY, 150, 100);
              ctx.stroke();
  
  
          }else if(shape==3){
              ctx.rect(e.offsetX, e.offsetY, 50, 50);
              ctx.stroke();
          }
      }
  
          function circleClicked(){
              shape=0;
          }
          function triangleClicked(){
              shape=1;
          }
          function rectangleClicked(){
              shape=2;
          }
          function squareClicked(){
              shape=3;
          }
          function redClicked(){
              color=1;
          }
          function blueClicked(){
              color=3;
          }
          function yellowClicked(){
              color=2;
          }
  
  </script>;
  
  <script type="text/javascript">
              var c = document.getElementById("myCanvas");
              c.addEventListener("click", myClickEvent);
              document.getElementById("circle").addEventListener("click", circleClicked);
              document.getElementById("line").addEventListener("click",  triangleClicked);
              document.getElementById("rectangle").addEventListener("click",rectangleClicked);
              document.getElementById("square").addEventListener("click",squareClicked);
              document.getElementById("red").addEventListener("click",redClicked);
              document.getElementById("blue").addEventListener("click",blueClicked);
              document.getElementById("yellow").addEventListener("click",yellowClicked);
             
  </script>
  