I\'m trying to create a fairly simple piece of JavaScript that displays a random image from an array each time the page loads. I need to figure out a way to get this runnin
you don't need an onload in the body tag- add a handler in the script, in the head, or in another script that loads before the body .
(function(){
var fun=function(){
// definefunction
}
if(window.addEventListener){
window.addEventListener('load', fun,false);
else if(window.attachEvent)window.attachEvent('load', fun);
})();