To explain, I'm trying to change an image elsewhere on the page when I hover over a smaller version of it.
The code below is for the big image box and the smaller boxes which have the thumbnails.
The JS I was hoping would change the large image to match the thumbnail when the mouse is over the thumbnail box and when moved away it would change back to the default image which was there originally.
Clearly I am doing something wrong and it doesn't surprise me as I'm not getting to grips with Javascript as quickly as I thought I might. Any help is welcome!
The code below is for the big image box and the smaller boxes which have the thumbnails.
Code:
<div id="imagelarge"><img id="large" src="default.jpg" alt="" /></div>
<div id="imagebox" class="small">
<img class="thumb" src="test.jpg" alt="Test" onMouseOver="changeimage('test.jpg');" onMouseOut="changeimage('default.jpg');" />
</div>
The JS I was hoping would change the large image to match the thumbnail when the mouse is over the thumbnail box and when moved away it would change back to the default image which was there originally.
Code:
<script type="text/javascript">
function changeimage(image)
{
document.getElementById(large).src = 'image';
}
</script>
Clearly I am doing something wrong and it doesn't surprise me as I'm not getting to grips with Javascript as quickly as I thought I might. Any help is welcome!
