Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 29th, 2012  |  syntax: None  |  size: 0.22 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to preload style image to use it when server is down?
  2. var img = document.createElement('img');
  3. img.src = "/path/to/image";
  4.        
  5. img.style.position = "absolute";
  6. img.style.left = "-10000px";
  7. document.body.appendChild(img);