Preloading Images Via JavaScript
Wrong Way: Changing A Single HTML img src Attribute

Images will be preloaded by changing a single HTML img element's src attribute via JavaScript. The net effect will be to "preload" only the last image specified.

Dumb Way: Using HTML And CSS
Example 1: Using JavaScript's appendChild() Method
Example 2: Using jQuery And document.ready()
Preloading Images Via JavaScript