[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: elements array
>>my question is:
>>I have some Data stored in cookies and want to put it in a
>>hidden Form to
>>submit it. To make the Code as short as possible, I would like
>>to access
>>the hidden fields like that:
>>document.FormName.elementsYindex".value = MyCookieData;
I am new to Java, but in Rexx which there are associative
arrays that are similar.
To do what you want I would suggest the EVAL
statement. This should allow you to build the variable name
on the fly, then interpret it to do your assignment.
Here is a guess at how to code it
for (var i = 1; i < 4; i++ {
eval("document.FormName.HiddenName"i".value = MyCookieData")
}
Please forgive my syntax if it is wrong, I think the method
is ok.
Good luck!
--
Mark Short
Senior Consultant
Hoechst Marion Roussel, Inc.
Kansas City, MO
markshort@hmri.com
--------------------------------------------------------------------
This message came from the mailing list javascript. For help using the
mailing list software, please send a message to 'majordomo@obscure.org'
with the message body 'help'. To unsubscribe, send a message to
'majordomo@obscure.org' with the message body 'unsubscribe javascript'.