Hi I’m trying to write some code to cycle the value of my universal variable window.BodyPart (BodyPart) being passed to the function when it’s called (onclick event of imagemap). For example onclick=AddMassinst(‘shoulder’), then using window.shoulder by refering to it through window.BodyPart (is that right or is my syntax all messed, or is that even possible?)
Here’s my code, I’m expecting window.BodyPart to cycle through blank, a, b, c, then blank (undefined) again. I’m very new to this so please forgive my ignorance.
function AddtoMassInst(BodyPart)
{
alert(window.BodyPart)
if (window.BodyPart=”)
{
window.BodyPart=’a’
}
else if (window.BodyPart=’a’)
{
window.BodyPart=’b’
}
else if (window.BodyPart=’b’)
{
window.BodyPart=’c’
}
else if (window.BodyPart=’c’)
{
window.BodyPart=”
}
else
{
alert(“else!”)
}
return true;
}