<div id='main'></div>
<div id='pic'>
<img src='http://javascript.ru/forum/image.php?u=12890&dateline=1303149256'>
<img src='http://javascript.ru/forum/image.php?u=19820&dateline=1334914235'>
</div>
<script>
var pic = document.getElementById('pic').getElementsByTagName('img')
for(i=0;i<pic.length;i++) {
pic[i].onclick='change()'
}
function change(event) {
event = event || window.event
var elem = event.target || event.srcElement
document.getElementById('main').innerHTML = '<img src='+elem.src+'>'
}
</script>