So I\'m new with JavaScript (this is actually my first attempt to make something work) and I\'m having a bit of trouble. I thought I had enough knowledge to make this work,
You've got a few changes (this assumes you indeed still want to change the image with an ID of IMG, if not use Shadow Wizard's solution).
Remove a.src
and replace with a
:
<script type="text/javascript">
function changeImage(a) {
document.getElementById("img").src=a;
}
</script>
Change your onclick
attributes to include a string of the new image source instead of a literal:
onclick='changeImage( "1772031_29_b.jpg" );'