You are here:   Home > Scripts > Javascript Preload Images
What's
New
Doll
Makers
Room
Makers
Puzzle
Makers
Dress Up
Games
GirlSense - online dress up games for girls with fashion sense

Back to Scripts

Javascript, How to Preload Images



Preloading images using javascript requires placing a reference to them within the <HEAD> tags of the HTML document.

  1. Does the document.images object exist? (check for older browsers)
  2. Create a new Image
  3. Set the .src to reference the image url location

Copy and paste the javascript source below in your HTML document inside the <HEAD> tags

Javascript Source



To Preload a list of images





How is it referenced in the HTML?

You would call the image src normally.
i.e.
<img name="myimage" src="someimage.gif">
<a href="#" onMouseOver="javascript:document.myimage.src='http://mydomain.com/image0.gif'">





About     Privacy Policy     Hosting by Web Hosting Canada

Except where otherwise noted, this site is licensed under a Creative Commons License



contact us: elouai@gmail.com
©2003-2008 eLouai.com, All rights reserved