[thelist] js function with variable parameters...need advice
Jason Handby
jasonh at pavilion.co.uk
Mon Feb 10 16:12:01 CST 2003
> Can I just put say 4 variables in the paramters and test to see if
> they exist? This doesn't seem very elegant.
>
> I'm guessing some sort of an array and for loop but I can't figure it
> out..
You could pass them in a string, and then use split() to turn it into an
array, e.g.
onChange="enableFields('fieldName1,fieldName2,fieldName3')"
function enableFields(fieldNames)
{
var fieldArray = fieldNames.split(',');
// and so on!
}
More information about the thelist
mailing list