<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>每天一个JavaScript实例-判断图片是否加载完成</title>
<script>
window.οnlοad= function(){
//clearTimeout(clock);
alert("加载完成");
}
var item = document.getElementsByTagName("img");
var clock = setTimeout(function(){
//var item = document.getElementsByTagName("img");
//console.log(item);
//console.log(item.item(item.length-1).onload);
if(item.item(item.length-1).onload == null){
alert("还没加载完成呢!");}
},1000)
</script>
</head>
<body>
<img src="http://i1.hoopchina.com.cn/blogfile/201401/13/BbsImg138957793449615_500*311.jpg" />
<img src="http://www.xyzwallpaper.com/wp-content/uploads/2014/07/girl-wallpaper-300x300.jpg" />
<img src="http://www.xyzwallpaper.com/wp-content/uploads/2014/07/girl-wallpaper-2-300x300.jpg" />
<img src="http://www.xyzwallpaper.com/wp-content/uploads/2014/07/girl-wallpaper-3-300x300.jpg" />
<img src="http://www.xyzwallpaper.com/wp-content/uploads/2014/07/girl-wallpaper-4-300x300.jpg" />
<img src="http://bestpaperz.com/data_images/out/40/8903786-shakira-in-the-chair.jpg" />
<img src="http://bestpaperz.com/data_images/out/40/8903770-red-currant.jpg" />
<img src="http://i1.hoopchina.com.cn/blogfile/201401/13/BbsImg138957793449615_500*311.jpg" />
<img src="http://bestpaperz.com/data_images/out/40/8903733-failed-surfing.jpg" />
<img src="http://bestpaperz.com/data_images/out/40/8903738-robert-pattinson.jpg" />
<img src="http://i1.hoopchina.com.cn/blogfile/201401/13/BbsImg138957793449615_500*311.jpg" />
<img src="http://bestpaperz.com/data_images/out/40/8903728-empty-bench.jpg" />
<img src="http://i1.hoopchina.com.cn/blogfile/201401/13/BbsImg138957793449615_500*311.jpg" />
<img src="http://bestpaperz.com/data_images/out/40/8903801-snow-park.jpg" />
</body>
</html>