Originally Posted by boyo1991
well its meant to be invoked by either <body onload="main()"> or if one really wishes, onclicks...
onload is also unnecessary except if your script needs to confirm if all the images have loaded. For simple interactions with the page simply attaching the script at the bottom of the page results in a lot less code and the script running a lot sooner.
Also alert() is for debugging purposes only and should never be used in a published script.