[thelist] [JavaScript] way around these global vars? [correction]
Tom Dell'Aringa
pixelmech at yahoo.com
Tue Feb 7 11:12:59 CST 2006
Ugh, correction to my last post - it is seeing the method as stickystate.showHit() - it's my if
condition that is failing now (if(!btn)) - somehow btn is set still? When I alert() it, it comes
back undefined. Yet it does not enter the if condition as earlier...
stickystate = {
currentBtn:null,
showHit:function(btn)
{
if(!btn)
{
var newImg = this.currentBtn.style.backgroundImage;
newImg = newImg.replace("_on", "");
this.currentBtn.style.backgroundImage = "url(/images/" +newImg+ ")";
return;
}
else
{
var urlArray = btn.style.backgroundImage.split("/");
var img = urlArray[urlArray.length -1].replace(".gif)", "");
var on = "url(/images/" + img + "_on" + ".gif)";
this.currentBtn = btn;
btn.style.backgroundImage = on;
setTimeout("stickystate.showHit()", 500)
}
}
}
Tom
http://www.pixelmech.com/
http://www.crossandthrone.com/
Professor Rumford: 'But I still don't understand about hyperspace.'
The Doctor: 'Well, who does?'
K9: 'I do.'
Doctor: 'Shut up, K9!'
More information about the thelist
mailing list