preloading img javascript code example

Example: preload images javascript

<script>

/*
Preload images script
By JavaScript Kit (http://javascriptkit.com)
Over 400+ free scripts here!
*/

var myimages=new Array()
function preloadimages(){
for (i=0;i<preloadimages.arguments.length;i++){
myimages[i]=new Image()
myimages[i].src=preloadimages.arguments[i]
}
}


//Enter path of images to be preloaded inside parenthesis. Extend list as desired.
preloadimages("http://mydomain.com/firstimage.gif","http://mydomain.com/secondimage.gif","http://mydomain.com/thirdimage.gif")

</script>