I have a simple Canvas element in my HTML5 Code and trying to draw in it with a external javascript file.
<script src="script.js" type="text/javascript"></script>
<canvas id="can1" width="50px" height="50px"></canvas>
//script.js:
var can1 = document.getElementById("play");
var can1Context = play.getContext("2d");
can1Context.fillStyle="#FF0000";
can1Context.fillRect(0,0,150,75);
But this is not working, but if the script is in the same file as the Canvas Element, it works. Can somebody explain that to me?