[TriLUG] Stuck in a rut
Michael Peters
mpeters at plusthree.com
Tue Sep 15 16:21:52 EDT 2009
On 09/15/2009 04:08 PM, Brian McCullough wrote:
> var name = 'ex-' + counter;
> var len = document.example.name.length;
Yeah that won't work because it's treating "name" as the method "name".
You should remember that all JS objects are also associative arrays, so
you can use that string (in the variable "name") as the key:
var name = 'ex-' + counter;
var len = document.example.elements[name].length;
--
Michael Peters
Plus Three, LP
More information about the TriLUG
mailing list