[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.

Tom

=====
var me = tom.pixelmech.webDeveloper();

http://www.pixelmech.com/
http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]

__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com



More information about the thelist mailing list