biryukovm,
- если структура такаяже, если ie > 8
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
</script>
<script>
var $e = function(elem, eventName, handler) {
elem.addEventListener
? elem.addEventListener(eventName, handler, false)
: elem.attachEvent('on' + eventName, handler);
};
window.onload = function() {
var thumbs = document.querySelectorAll('.thumbs img'), i = thumbs.length;
while (i) $e(thumbs[--i], 'mouseover', function() {
this.parentNode.nextElementSibling.querySelector('img').src = this.src;
});
};
</script>
</head>
<body>
<div class="thumbs">
<img src="http://learn.javascript.ru/files/tutorial/browser/events/gallery/img2-thumb.jpg">
<img src="http://learn.javascript.ru/files/tutorial/browser/events/gallery/img3-thumb.jpg">
<img src="http://learn.javascript.ru/files/tutorial/browser/events/gallery/img4-thumb.jpg">
<img src="http://learn.javascript.ru/files/tutorial/browser/events/gallery/img5-thumb.jpg">
<img src="http://learn.javascript.ru/files/tutorial/browser/events/gallery/img6-thumb.jpg">
</div>
<div><img src="http://learn.javascript.ru/files/tutorial/browser/events/gallery/img2-thumb.jpg"></div>
<div class="thumbs">
<img src="http://learn.javascript.ru/files/tutorial/browser/events/gallery/img2-thumb.jpg">
<img src="http://learn.javascript.ru/files/tutorial/browser/events/gallery/img3-thumb.jpg">
<img src="http://learn.javascript.ru/files/tutorial/browser/events/gallery/img4-thumb.jpg">
<img src="http://learn.javascript.ru/files/tutorial/browser/events/gallery/img5-thumb.jpg">
<img src="http://learn.javascript.ru/files/tutorial/browser/events/gallery/img6-thumb.jpg">
</div>
<div><img src="http://learn.javascript.ru/files/tutorial/browser/events/gallery/img2-thumb.jpg"></div>
</body>
</html>