Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Canvas Issue Example</title>
    <style>
      #canvas1 {
        width: 200px;
        height: 200px;
        border: 1px solid black;
      }
    </style>
    <script type="text/javascript">
      function canvasClicked(number) {
        var c = "canvas" + number;
        var canvas = document.getElementById(c);
        var context = canvas.getContext("2d");
        var centerX = 100;
        var centerY = 100;
        context.beginPath();
        context.arc(centerX, centerY, 70, 0, Math.PI * 2);
        context.lineWidth = 10;
        context.strokeStyle = "red";
        context.stroke();
      }
    </script>
  </head>
  <body>
    <canvas id="canvas1" onclick="canvasClicked(1)" width="200" height="200"></canvas>
  </body>
</html>
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers