[thelist] js function with variable parameters [solved]

Tom Dell'Aringa pixelmech at yahoo.com
Tue Feb 11 08:26:17 CST 2003

--- ".jeff" <jeff at members.evolt.org> wrote:

> you're so very close to the solution.  a function has an arguments
> array.

> function enableFields(oForm)
> {
>   for(i = 1; i < arguments.length; i++)
>   {
>     field = oForm.elements[arguments[i]];
>     if(field)
>       field.disabled = false;
>   }
> }

> enabledFields(this.form, 'foo', 'bar', 'boo', 'far');

Thanks again .jeff! Exactly what I wanted. I didn't realize you could
grab the arguments like that...I love JS more each day :P.

Also thank you to the three other replies I got as well.


var me = tom.pixelmech.webDeveloper();

[Making A Commercial Case for Adopting Web Standards]

Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day

More information about the thelist mailing list