You are here: irt.org | FAQ | JavaScript | Form | Q1591 [ previous next ]
In Netscape Navigator 3+ and Internet Explorer 4+ (i.e. JavaScript 1.2) you can interrogate the form field's type property:
<form name="myForm"> <input type="text"> <input type="radio"> <input type="checkbox"> </form> <script language="JavaScript"><!-- var o = ''; if (document.myForm.elements[0].type) for (i=0;i < document.myForm.elements.length;i++) o += document.myForm.elements[i].type + '\n'; alert(o); //--></script>