I'm not very good with Javascript and am trying to get three images to swap to a different image on mouse over, and back again on mouse out. I can't seem to get it working though. Could someone in the know be able to take a quick look? This is the script which is imported in the head section of my source:
CODE
Martin[0] = new Image(180,180)
Martin[0].src = "./images/about/colour_martin.jpg"
Jase[0] = new Image(180,180)
Jase[0].src = "./images/about/colour_jase.jpg"
Andy[0] = new Image(180,180)
Andy[0].src = "./images/about/colour_andy.jpg"
Martin[1] = new Image(180,180)
Martin[1].src = "./images/about/grey_martin.jpg"
Jase[1] = new Image(180,180)
Jase[1].src = "./images/about/grey_jase.jpg"
Andy[1] = new Image(180,180)
Andy[1].src = "./images/about/grey_andy.jpg"
function MouseOver(imgID, name) {
document.[imgID].src = [name][0].src;
return true;
}
function MouseOut(imgID, name) {
document.[imgID].src = [name][1].src;
return true;
}
Martin[0].src = "./images/about/colour_martin.jpg"
Jase[0] = new Image(180,180)
Jase[0].src = "./images/about/colour_jase.jpg"
Andy[0] = new Image(180,180)
Andy[0].src = "./images/about/colour_andy.jpg"
Martin[1] = new Image(180,180)
Martin[1].src = "./images/about/grey_martin.jpg"
Jase[1] = new Image(180,180)
Jase[1].src = "./images/about/grey_jase.jpg"
Andy[1] = new Image(180,180)
Andy[1].src = "./images/about/grey_andy.jpg"
function MouseOver(imgID, name) {
document.[imgID].src = [name][0].src;
return true;
}
function MouseOut(imgID, name) {
document.[imgID].src = [name][1].src;
return true;
}
Here is the relevent section of HTML:
CODE
<div class='aboutblurb'>
<a href='#'><img src='./images/about/grey_martin.jpg' width='180' height='180' id='pf_martin' alt='Martin Fillingham'
onmouseover="MouseOver('pf_martin', 'Martin')"
onmouseout="MouseOut('pf_martin', 'Martin')" /></a>
</div>
<div class='aboutblurb'>
<a href='#'><img src='./images/about/grey_jase.jpg' width='180' height='180' id='pf_jase' alt='Jason Brooks'
onmouseover="MouseOver('pf_jase', 'Jase')"
onmouseout="MouseOut('pf_jase', 'Jase')" /></a>
</div>
<div class='aboutblurb'>
<a href='#'><img src='./images/about/grey_andy.jpg' width='180' height='180' id='pf_andy' alt='Andy Black'
onmouseover="MouseOver('pf_andy', 'Andy')"
onmouseout="MouseOut('pf_andy', 'Andy')" /></a>
</div>
<a href='#'><img src='./images/about/grey_martin.jpg' width='180' height='180' id='pf_martin' alt='Martin Fillingham'
onmouseover="MouseOver('pf_martin', 'Martin')"
onmouseout="MouseOut('pf_martin', 'Martin')" /></a>
</div>
<div class='aboutblurb'>
<a href='#'><img src='./images/about/grey_jase.jpg' width='180' height='180' id='pf_jase' alt='Jason Brooks'
onmouseover="MouseOver('pf_jase', 'Jase')"
onmouseout="MouseOut('pf_jase', 'Jase')" /></a>
</div>
<div class='aboutblurb'>
<a href='#'><img src='./images/about/grey_andy.jpg' width='180' height='180' id='pf_andy' alt='Andy Black'
onmouseover="MouseOver('pf_andy', 'Andy')"
onmouseout="MouseOut('pf_andy', 'Andy')" /></a>
</div>
Thanks!

