<!DOCTYPE HTML> | |
<html> | |
<head> | |
<script> | |
function main() | |
{ | |
var ctx = document.getElementById("c").getContext("2d"); | |
ctx.fillStyle = 'red'; | |
ctx.fillRect(20,20,50,50); | |
ctx.fillStyle = 'green'; | |
ctx.fillRect(70,20,50,50); | |
ctx.fillStyle = 'blue'; | |
ctx.fillRect(20,70,50,50); | |
ctx.fillStyle = 'black'; | |
ctx.fillRect(70,70,50,50); | |
} | |
</script> | |
</head> | |
<body onload="main()"> | |
<canvas id="c" width="140" height="140" class="nomargin"></canvas> | |
</body> | |
</html> |