[thelist] Javascript Eval Help....

Anthony Baratta Anthony at Baratta.com
Tue Jul 23 23:12:01 CDT 2002


At 06:44 PM 7/23/2002, .jeff wrote:

>you don't need to use the eval() method at all.  use the elements array to
>access those dynamically named form elements.
>
>like this:
>
>document.FormOOS.elements['prod' + x + 'Subtotal'].value;

I knew there was a better way!!!

Still, the JS reference at Netscape says I can have the eval on the left
side of a '='.

http://developer.netscape.com/docs/manuals/js/client/jsref/toplev.htm#1063795

Example 4. In the following example, the setValue function uses eval to
assign the value of the variable newValue to the text field textObject:

function setValue (textObject, newValue) {
    eval ("document.forms[0]." + textObject + ".value") = newValue
}

So am I miss reading the above example??
---
Anthony Baratta
President
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."




More information about the thelist mailing list