Web Hosting Offers
See the new scripts recently added to Dynamic Drive. Click here.
Original, practical CSS codes and examples such as CSS menus for your site.
    Search code samples  
 
  Keyword
 
 
 
   
 
 
  Code Samples
 
ASP
CSS
Dhtml
Html
Javascript
PHP
 
   
     LOGIN HERE  
 
Username
Password
Forgot Password
Verify Signup
 
 
 

Javascript >> Images

How do I preload images?

Visitor Ratings (0) :

Description
Client side JavaScript starting with JavaScript 1.1 (NN3+, IE4+) has
the Image object for that.

You create an Image object and preload an image with
if (document.images) {
var image = new Image();
image.src = 'whatever.gif';
}

Then the image is asynchronically downloaded while the rest of the
script/page is processed. You can then use that Image object in an
onmouseover for e.g. see the sample code
Code
Select All
 Rate this Resource