[thelist] [JavaScript] way around these global vars?

Christian Heilmann codepo8 at gmail.com
Tue Feb 7 10:20:04 CST 2006

> Yeah, that would work wouldn't it. Am I going too far down the oo road here? Should I not worry
> about the global vars and just go ahead with it? Is there any performance difference in the object
> method vs. plain vars method? I mean the function works fine, I'm just anal about writing the best
> code I can, and the easiest to maintain.

I am more worried about the state of the other code :-) The object
literal is a wonderful idea as it does keep everything together that
should be together.

Why do you need two variables anyways? All you need is the current
object, then you read the backgroundImage and check if it contains
_on.gif or not and replace it with .gif and vice versa.

Chris Heilmann
Blog: http://www.wait-till-i.com
Writing: http://icant.co.uk/
Binaries: http://www.onlinetools.org/

More information about the thelist mailing list