1) Your trying to refer to an element with the id
"titleimg", yet you haven't given the element an id
at all.
2) Your if
condition doesn't compare titleid
with a string it compares it to what it thinks is a variable.. For example it should be 'video'
not video
.
3) In your second function your parameter should be a variable not a string.. For example it should be SwapBack(titleid)
not SwapBack('titleid')
.
You should try this...
JAVASCRIPT:
function SwapOut(titleid){
if (titleid == 'video')
document.getElementById("titleimg").src="images/videotitle.png"
else if (titleid == 'gamedesign')
document.getElementById("titleimg").src="images/gametitle.png"
else if (titleid == 'webdesign')
document.getElementById("titleimg").src="images/webtitle.png"
return true;
}
function SwapBack(titleid){
if (titleid == 'home')
document.getElementById("titleimg").src="images/hometitle.png"
else if (titleid == 'gamedesign')
document.getElementById("titleimg").src="images/gametitle.png"
else if (titleid == 'video')
document.getElementById("titleimg").src="images/videotitle.png"
else if (titleid == 'webdesign')
document.getElementById("titleimg").src="images/webtitle.png"
return true;
}
HTML:
<a id="eileenSmall1" href="video.html" onmouseover="SwapOut('video')" onmouseout="SwapBack('home')"></a>
<div id="title">
<img src="images/hometitle.png" name="titleimg" id="titleimg" />
</div>