- Jan 21, 2005
- 17,722
- 6
- 81
So given the following bit of code:
This is supposed to swap images of "spin on" and "spin off" whenever the user clicks on the div id. However, it never seems to make it into the spinStatus==false IF block. It will work the first time, switching from btn_spinoff.png to btn_spinon.png, but never vice versa. The alerts reveal that it is a false going in, and a false coming out. Not sure what I'm doing wrong...
Thanks in advance!
Code:
var spinStatus = true;
$("#spin").click(
function()
{
if (spinStatus == true)
{
$("#spin").attr('src', "../funktrek_new/images/btn_spinon.png");
spinStatus = false;
}
if (spinStatus == false)
{
$("#spin").attr('src', "../funktrek_new/images/btn_spinoff.png");
spinStatus = true;
alert(spinStatus);
}
}
);
Thanks in advance!
Last edited:
