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

Christian Heilmann codepo8 at gmail.com
Tue Feb 7 09:56:16 CST 2006


> Any ideas? Feel like I might be missing something obvious.

Encapsulate your function in one object and set the variables as
object properties?

stickystate{
lastImg:null,
currentBtn:null,
showHit:function(o){
...
}
}

You can then call stickystate.showHit() and read/write the properties
with stickystate.lastImg and so on.

--
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