external javascript document is not defined


I have been experimenting with the element lately, but I can't get any functions inside external Javascript files to work. You should see the request for the .js file. I will update the documentation accordingly. I’ll install Apache tomorrow and see if it works. New replies are no longer allowed. I'd say markr hit it on the nose.

Thank you WolfShade, function main() { var canvas = document.getElementById("mainCanvas"); var ctx=canvas.getContext("2d"); ctx.fillStyle="#FF0000"; ctx.fillRect(0,0,150,75); console.log("Drew rectangle"); } When I click the par a gr aph, Chrome's console gives me the message, "Uncaught ReferenceError: main is not defined." Sign in Save the script file with a .js extension, and then refer to it using the src attribute in the