frm = document.forms[0]; total = 0; for (i=1; ele=frm.elements[i]; i++) if (ele.type=='text') total++