I'm trying to write a function that will create an array of textfield objects. I have a function called addNewItem() that everytime the tab key is entered in the textfield it creates a new row of textfields...which can create an infinite number of textfields. What i'm trying to do is everytime a textfield is created, to add that textfield as an array element into the array. I will then have an array of textfield objects. I then need to retrieve all the values from the textfields. I believe my makeArray function needs fixing somehow, it only adds one element. COuld someone help please. here is my functions below: function addNewItem() { // Increase the number of items numItems++; document.getElementById("textfields").innerHTML += 'Item '+numItems+' <BR>Description<INPUT TYPE="text" NAME="description'+numItems+'" VALUE=""> Part Number <INPUT TYPE="text" NAME="partno'+numItems+'" VALUE="" ONKEYDOWN="if (event.keyCode==9) { addNewItem(); }"><BR>'; makeArray('description '+numItems+''); } function makeArray() { this[0] = makeArray.arguments.length; for (i = 0; i<makeArray.arguments.length; i++) { this[i+1] = makeArray.arguments[i]; } return this; } function verifySave() { msg = confirm("Are you sure you want to save this data?") if (msg) { var e = document.forms['genericform'].elements; for (var i = 0; i<numItems; i++) { alert(e[fieldDesNames[i]].value); } } } Code (markup):