<!DOCTYPE html> | |
<html> | |
<body> | |
<p>A green square should appear below this text.</p> | |
<canvas id="c" width="100" height="100"></canvas> | |
<script> | |
window.onload = function() { | |
var canvas = document.getElementById("c") | |
var ctx = canvas.getContext("2d") | |
ctx.fillStyle = 'green'; | |
ctx.fillRect(0, 0, 100, 100); | |
} | |
</script> | |
</body> | |
</html> |