Preloading multiple images in Javascript

<script language="JavaScript"
type="text/JavaScript">
function preloadImages(urls) {
var img = new Array();
for (var i=0; i<urls.length; i++) {
img[img.length] = new Image();
img[img.length - 1].src = urls[i];
}
}
window.onload = function() {
var img = new Array(
"active.gif", "inactive.gif", "other.gif");
preloadImages(img);
}
</script>
Share Article/Example:
  • Facebook
  • Twitter
  • del.icio.us
  • Digg
  • DotNetKicks
  • DZone