Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body> <canvas id="myCanvas" width="200" height="200" style="border:1px solid"> Your browser does not support the HTML5 canvas tag. </canvas> <br> <script> var c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); ctx.fillStyle = "#92B901"; ctx.fillRect(50, 50, 100, 100); function clearCanvas() { c.height = 300; } </script> <button onclick="clearCanvas()">Clear canvas</button> </body> <!-- Mirrored from www.w3schools.com/tags/tryit.asp?filename=tryhtml5_canvas_height_width_clear by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:23:16 GMT --> </html>
Result:
Try it Yourself - © w3schools.com