Anda di halaman 1dari 1

<!DOCTYPE html> <html> <head> <title> Drawing a triangle</title> <script> function draw(){ var can=document.getElementById("myCanvas"); if(can.getContext) { var cxt=can.

getContext("2d"); cxt.beginPath(); cxt.moveTo(20,20); cxt.lineTo(10,30); cxt.lineTo(20,40); cxt.lineTo(20,20); cxt.lineWidth=3; cxt.lineCap="round"; cxt.stroke(); //cxt.closePath(); } else{ document.write("<p> Your Browser does not support HTML5 canvas tag</p>"); } } </script> <style type="text/css"> canvas {border:1px solid black;} </style> </head> <body onload="draw();"> <canvas id="myCanvas" width="125px" height="125px"> </canvas>

Anda mungkin juga menyukai