Click to See Complete Forum and Search --> : Reading object values using selection lists


qmsinternet
08-23-2003, 09:20 AM
I am trying to allow a user to read a value from a custom object using a selection list but the selection is not recognised as a valid object.

For example, the user selects a name from a list which should then display the person's age when the relevant button is clicked. The selection box has a list of names. one of which is 'Fred'. The statement 'Fred[2]' should report the second value in 'Fred' which is the age in this example which it does if used in an alert or similar statement.

I can read the name selection and get an alert box to report 'Fred found' or whatever. Eg
'alert(NameSelected + " found");'

However, but the composite statement of 'NameSelected[2]' is not recognised.

Do i have to change the type or is there a better way of doing this.

Fang
08-23-2003, 12:58 PM
var ArrayContent=eval(NameSelected+'[2]');