[latex]Mae govannen![/latex]
... und ist völliger Unsinn von jemandem, der von Javascript sehr wenig Ahnung zu haben scheint. Die von ChrisB erwähnte Schreibweise object["name"] funktioniert genauso gut, ist performanter und birgt nicht die potentiellen Gefahren von eval.
Wenn du gobale Variablen willst, mußt du halt für object das oberste JS-Object window einsetzen
Dennoch ist es auch weiterhin besser, die Variablen als Elemente in _einem_ Array zu sammeln und dieses dann meinetwegen global zu verwenden, wenn es sich gar nicht vermeiden lässt.
Und: wer für sowas eval() nutzt, der frisst auch kleine Kinder und schubst alte Leute auf die Straße, wenn ein LKW kommt. ^^
Cü,
Kai
--
A workaround for an avoidable problem often adds clutter and overhead to the program which
could have been avoided by not creating the problem in the first place.(Garrett Smith/clj)
Foren-Stylesheet Site Selfzeug JS-Lookup
SelfCode: sh:( fo:| ch:? rl:( br:< n4:( ie:{ mo:| va:) js:| de:> zu:) fl:( ss:| ls:?
A workaround for an avoidable problem often adds clutter and overhead to the program which
could have been avoided by not creating the problem in the first place.(Garrett Smith/clj)
Foren-Stylesheet Site Selfzeug JS-Lookup
SelfCode: sh:( fo:| ch:? rl:( br:< n4:( ie:{ mo:| va:) js:| de:> zu:) fl:( ss:| ls:?