[thelist] Javascript Eval Help....

.jeff jeff at members.evolt.org
Tue Jul 23 23:18:00 CDT 2002


netscape,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Anthony Baratta
>
> Still, the JS reference at Netscape says I can have the
> eval on the left side of a '='.
>
> So am I miss reading the above example??
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

no, you're not misreading it at all.  this is an example of the documentation being incorrect.  try executing this statement in your choice of javascript enabled browser (paste as one long line):

javascript:myVar='foo';eval('self.'+myVar)='bar';alert(self[myVar]);void(0);

the error you will get will be different from browser to browser, but in essence they're complaining that you're using eval() on the left side of an assignment operator (=).

now you know the solution though -- you don't ever need to use eval().

;p

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/






More information about the thelist mailing list