| re: eval() not working in firefox
Angel wrote:[color=blue]
> Hello Everybody,
>
> I have the following lines in my code
>
> 1)
> totalElements=eval("document."+formname+".RCBillin gCycle"+totalRCRows+".length")
>
> 2) var newoption=new Option (BillingCycleName,BillingCycleId);
> eval("document."+formname+".RCBillingCycle"+totalR CRows+".options[totalElements]=
> newoption");
>
> In both statements above, the eval code doesnt work in firefox. Is
> there a workaround?[/color]
No workaround is needed as there is no need to use - eval - at all and
it is more likely the shortcut property accessors that is not working
in Firefox.
Replace:-
eval("document."+formname+".RCBillingCycle"+totalR CRows+".length")
-with:-
document.forms[formname].elements['RCBillingCycle'+totalRCRows].length;
- and replace:-
eval("document."+formname+".RCBillingCycle"+totalR CRows+
".options[totalElements]= newoption");
-with:-
document.forms[formname].elements['RCBillingCycle'+
totalRCRows].options[totalElements]= newoption
Richard. |