Hi
I have this javascript that I would like to change images, but it does not work, and since I'm not familiar at all with javascript I could use a little help.
function changeMySrc(i)
{
if i == 1
document.getElementById("Img1").src="Images/folder_open.gif";
document.getElementById("Img2").src="Images/folder.gif";
}
else if i == 2
{
document.getElementById("Img2").src="Images/folder_open.gif";
document.getElementById("Img1").src="Images/folder.gif";
}
}
<a href="#" onclick="changeMySrc(1)" onMouseover="change_img()" onMouseout="change_back()"><img id="Img1" src="Images/folder.gif" /></a>
<a href="#" onclick="changeMySrc(2)" onMouseover="change_img()" onMouseout="change_back()"><img id="Img2" src="Images/folder.gif" /></a><br />
Can someone please tell me what I do wrong?
Regards
I have this javascript that I would like to change images, but it does not work, and since I'm not familiar at all with javascript I could use a little help.
function changeMySrc(i)
{
if i == 1
document.getElementById("Img1").src="Images/folder_open.gif";
document.getElementById("Img2").src="Images/folder.gif";
}
else if i == 2
{
document.getElementById("Img2").src="Images/folder_open.gif";
document.getElementById("Img1").src="Images/folder.gif";
}
}
<a href="#" onclick="changeMySrc(1)" onMouseover="change_img()" onMouseout="change_back()"><img id="Img1" src="Images/folder.gif" /></a>
<a href="#" onclick="changeMySrc(2)" onMouseover="change_img()" onMouseout="change_back()"><img id="Img2" src="Images/folder.gif" /></a><br />
Can someone please tell me what I do wrong?
Regards