Created
November 1, 2011 10:32
-
-
Save sofish/1330275 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang=""> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>hihi</title> | |
| </head> | |
| <body> | |
| <img id="thepic" src="javascript:''" /> | |
| <script type="text/javascript"> | |
| var preloadImg = function(url){ | |
| var img = new Image(); | |
| img.src = url; | |
| if(img.complete){ | |
| alert('complete') | |
| document.getElementById('thepic').src = url; | |
| retrun; | |
| } | |
| img.onload = function(){ | |
| alert('onload') | |
| document.getElementById('thepic').src = url; | |
| }; | |
| }; | |
| preloadImg('http://sofish.de/mypics/alipay_logo.png'); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment