Hi guys,

I've currently got some bodged code for changing an image within a div. I've since realised that IE 8 and below do not support an onclick method on an <option> tag and that this isn't good practice anyway.

I'm trying to get my head around reaching my desired result using onchange, but I'm struggling.

Here's the output as it stands using onclick:



Code:
<script language="javascript">

function swapImage(hash) {
	document.getElementById('imageSwap').src=''+hash+'.jpg';
}

</script>

Code:
<div id="builder_image">
 
<img src="rw_blue.jpg" id="imageSwap" alt="" />
 
</div>

Code:
<select name="option3">
        <option value="No thanks" selected="selected" onclick="swapImage('rw_blue');return false;">No thanks</option>
        <option value="Blue" onclick="swapImage('rw_blue');return false;">Blue</option>
        <option value="Black"onclick="swapImage('rw_black');return false;">Black</option>
        <option value="Red" onclick="swapImage('rw_red');return false;">Red</option>
</select>

Any help or pointers greatly appreciated as always. Cheers!