If you want to loop over all fields (input fields) on a CRM form, you can use the following script
//CRM 4 Jscript
for (var index in crmForm.all) {
var control = crmForm.all[index];
if (control.req && (control.Disabled != null)) {
//control is a CRM form field
}
}
The conditions mean that a control must have the "req" attribute and the "Disabled" method. This seems a good indicator for a CRM form field.