bakmaks,
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<script>
function getImages()
{
var I = [];
for ( var i = 0; i < 5; i++ )
{
var myImage = new Image();
myImage.src = "http://ru.lookatcode.com/show/9648057958996398/img" + (i+1) + "-lg.jpg";
I.push(myImage);
}
return I;
}
function onPhotoClick()
{
var photo = document.getElementById("photo");
photo.src = this.src;
}
window.onload = function()
{
var phContainer = document.getElementById('photoContainer');
var Images = getImages();
for (var i =0; i < 5; i++)
{
var newImg = new Image()
newImg.onload = function(){
this.width = this.width / 5;
this.height = 50;
}
newImg.src = Images[i].src;
newImg.onclick = onPhotoClick;
phContainer.appendChild(newImg);
}
}
</script>
</head>
<body>
<div id="photoContainer"></div>
<img id="photo" src="http://ru.lookatcode.com/show/9648057958996398/img1-lg.jpg"></img>
</body>
</html>