img的complete属性
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>img - complete attribute</title>
6 </head>
7 <body>
8 <img id="img1" src="http://pic1.win4000.com/wallpaper/f/51c3bb99a21ea.jpg">
9 <p id="p1">loading...</p>
10 <script type="text/javascript">
11 function imgLoad(img, callback) {
12 var timer = setInterval(function() {
13 if (img.complete) {
14 callback(img)
15 clearInterval(timer)
16 }
17 }, 50)
18 }
19 imgLoad(img1, function() {
20 p1.innerHTML('加载完毕')
21 })
22 </script>
23 </body>
24 </html>