paveltkachev, можно и без jquery строки 14, 15 и 25 вам ненужны -- да и в код выше можно добавить load.
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
.gallery img{
width: 150px;
height: 100px;
}
</style>
<script>
window.onload = function () {
var imgs = document.querySelectorAll('.gallery img');
var arr_src = ['http://www.anypics.ru/pic/201302/1366x768/anypics.ru-59453.jpg',
'http://www.wall-papers.ru/main.php?g2_view=core.DownloadItem&g2_itemId=38417&g2_serialNumber=3',
'http://w7t.ru/zooms/7da1/7/6168262b44.jpg',
'http://imgs.mi9.com/uploads/cartoon/4834/disney-cartoon-wallpaper_1366x768_88837.jpg',
'http://biskvitka.net/uploads/posts/2011-05/thumbs/1306582219_12.jpg'],len = arr_src.length;
for (var i = 0; i < arr_src.length; i++) {
var img = document.createElement('img');
img.onload = (function (a) {
return function () {
imgs[a].src = this.src;
len--;
!len && alert('complete')
}
})(i);
img.src = arr_src[i];
img.complete && img.onload()
}
}
</script>
</head>
<body>
<div class="gallery">
<img src="http://ozemanage.com/images/loading.gif" alt="" />
<img src="http://ozemanage.com/images/loading.gif" alt="" />
<img src="http://ozemanage.com/images/loading.gif" alt="" />
<img src="http://ozemanage.com/images/loading.gif" alt="" />
<img src="http://ozemanage.com/images/loading.gif" alt="" />
</div>
</body>
</html>