Have you checked for any javascript errors or debugged the javascript execution so that you know that the script runs?
Do you use jQuery?
*Edit - add alert() * Change the
case 1:
mypic = "/images/main_images/01.jpg";
break;
to
case 1:
alert('1');
mypic = "/images/main_images/01.jpg";
break;
If the javascript runs, you'll get an alert box whenever you try to change to img 1.
-------- Edit 2 ---------------
I wrote a small examle that works:
<img id="imgM" runat="server" src="~/Images/accent.png"/>
<input type="image" id="ith1" src="~/Images/bullet.png" alt="01" onclick="changePic(1)" />
<script type="text/javascript">
function changePic(num) {
var mypic = "";
switch (num) {
case 1:
mypic = "/Images/heroAccent.png";
alert(mypic);
break;
}
document.getElementById("imgM").src = mypic;
}
</script>
Do you use jquery? does the src attribute of the img tag get changed?