Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1591 How can I find out what kind of object a particular form field is?

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>

Feedback on 'Q1591 How can I find out what kind of object a particular form field is?'

©2018 Martin Webb