I have this function in a script in the header (generated by Fireworks, it works):
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments;
document.MM_sr=new Array;
for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){
document.MM_sr[j++]=x;
if(!x.oSrc)
x.oSrc=x.src;
x.src=a[i+2];
}
}
Then I have a table with a bunch of td and trs, including this one:
<td rowspan="2"><a href="javascript:;" onclick="MM_swapImage('slice1_s1','','images/slice1_s2.jpg',1);"><img name="slice1_s1" src="images/slice1_s1.jpg" width="146" height="87" border="0" id="slice1_s1" alt="" /></a></td>
Then, after the table ends, I put this script:
<script>
$("img").toggle(function(){
$(this).MM_swapImage('slice1_s1', '', 'slice1_s2.jpg', 1);
}, function(){
$(this).MM_swapImage('slice1_s1', '', 'slice1_s1.jpg', 1);
});
</script>
The tables and all are just the way Adobe Fireworks slices stuff up for the web, so that's all generated as well.
Here's what I want to happen: When the picture is clicked, I want it to change color (which is a second image I have ready, slice1_s2.jpg). When it is clicked again, I want it to go back to original. When I test this, nothing happens. Any suggestions?