CTRL+C pour copier, CTRL+V pour coller
5
<canvas id="mon_canvas" width="200" height="200"
6
style="border:1px solid #c3c3c3;">
7
Your browser does not support the canvas element.
11
var canvas = document.getElementById("mon_canvas");
12
var ctx = canvas.getContext("2d");
<!DOCTYPE html>
<html>
<body>
<canvas id="mon_canvas" width="200" height="200"
style="border:1px solid #c3c3c3;">
Your browser does not support the canvas element.
</canvas>
<script>
var canvas = document.getElementById("mon_canvas");
var ctx = canvas.getContext("2d");
ctx.beginPath();
ctx.moveTo(100,100);
ctx.lineTo(150,100);
ctx.lineTo(150,150);
ctx.lineTo(100,150);
ctx.lineTo(100,100);
ctx.closePath();
ctx.lineWidth = 5;
ctx.stroke();
</script>
</body>
</html>