Pa****@hushmail.com wrote:
<snip>
(i'm sure I'm missing something obvious) the eval line won't eval..
for(i = 1; i<=row; i++) {
for (j = 1; j <=OptionsCount; j++) {
eval="document.MyForm.MySelect"+i+".options["+j+"]=new
This is assigning a string value to a variable (global or local) called
'eval'. If that is a global variable then it may replace the gloabl -
eval - function, or not.
Option('"+MyValues[j]+"', '"+MyDescription[j]+"')";
eval(eval);
If the - eval - to which you assigned the stirng is a local variable
then that local - eval - will be making the global eval as it will come
first on the scope chain, thus you would be attempting to call a stirng
here. If the - eval - which the string value was assigned to was the
global one then again you may be attempting to call a string, or if the
global - eval - function did not allow itself to be replaced then it is
the global - eval - function that becomes the argument to your - eval -
call. You just cannot use the same Identifier as the name of a function
you call ant to pass it an argument at the same time, it will not work.
However, don't use - eval - for this at all, use bracket notation
property accessors instead:-
<URL:
http://www.jibbering.com/faq/faq_not..._brackets.html >
document.forms['MyForm'].elements['MySelect'+i].options[j] =
new Option(MyValues[j], MyDescription[j]);
Richard.