Is my code right?

I’m trying to add java script to my website so it loads my background image. I followed a tutorial from here, http://thecodecentral.com/2008/02/21/a-useful-javascript-image-loader and so I copy and pasted this code into note pad:

var loader = new ImageLoader(‘http://www.website.com/htdocs/image.jpg’);

loader.loadEvent = function(url, image){
//actions to perform when the image is loaded
//alert(url + ’ is loaded’);
document.body.appendChild(image);
//hide loading indicator if applicable
}

loader.load();

and saved the file as imageloader.js. I didn’t put the actual website or image in this post because I don’t want it to get referenced when searching my website in google. When I open the page, there is no loader, the image takes a couple seconds to load when you first go to my page like usual. Am I doing something wrong? did I call the file a wrong name? should I reference imageloader.js in the html code of the webpage? Thanks for your time!

yes if you want that web page to run that code.

<script type=“text/javascript” src=“imageloader.js”></script>