M
Marc Miller
I have an html img with a source of 'lbug.gif'. I want to be able to change
out the source of the img by clicking a button. Here's my code:
function swapPic()
{
if (document.Form1.imgBug.src = "lbug.gif")
{
document.Form1.imgBug.src = "stopbug.jpg";
}
else if (document.Form1.imgBug.src = "stopbug.jpg")
{
document.Form1.imgBug.src = "lbug.gif"
}
}
When I click the button the 1st time, the code executes as expected. Each
successive
time I click the button, the same code executes which is the:
if (document.Form1.imgBug.src = "lbug.gif")
{
document.Form1.imgBug.src = "stopbug.jpg";
}
And the source never switches back to 'lbug.gif'
What concept am I missing here?
TIA,
Marc Miller
'Confused in Northeast Penna.'
out the source of the img by clicking a button. Here's my code:
function swapPic()
{
if (document.Form1.imgBug.src = "lbug.gif")
{
document.Form1.imgBug.src = "stopbug.jpg";
}
else if (document.Form1.imgBug.src = "stopbug.jpg")
{
document.Form1.imgBug.src = "lbug.gif"
}
}
When I click the button the 1st time, the code executes as expected. Each
successive
time I click the button, the same code executes which is the:
if (document.Form1.imgBug.src = "lbug.gif")
{
document.Form1.imgBug.src = "stopbug.jpg";
}
And the source never switches back to 'lbug.gif'
What concept am I missing here?
TIA,
Marc Miller
'Confused in Northeast Penna.'