JavaScript Test

This is a first test with JavaScript canvas in a WordPress post. There is an external script file with the following content.


Here you go.
 

window.addEventListener("load", eventWindowLoaded, false);
 
function canvasApp() {
	var theCanvas = document.getElementById("canvas1");
	var context = theCanvas.getContext("2d");
 
	context.fillStyle = "#ffffaa";
	context.fillRect(0, 0, 500, 400);
 
	context.strokeStype = "#ff0000";
	context.strokeRect(10, 10, 480, 380);
}
 
function eventWindowLoaded() {
	canvasApp();
}

In the post, I need to specify the script location and the canvas tag similar to the following.

<script src="http://yourwebsite.com/Scripts/example.js" type="text/javascript"></script>
<canvas id="canvas1" width="500" height="400">Here you go.</canvas>