|
Q711 How do I tell if a field exists on a form?
irt.org | Knowledge Base | JavaScript | Form 3.1 | Q711 [ previous next ]
Q711 How do I tell if a field exists on a form?
Try:
<FORM NAME="myform">
<INPUT TYPE="TEXT" NAME="myfield">
</FORM>
<SCRIPT LANGUAGE="JavaScript"><!--
if (document.myform.myfield)
alert('myfield exists');
else
alert('myfield does not exist');
if (document.myform.myotherfield)
alert('myotherfield exists');
else
alert('myotherfield does not exist');
//--></SCRIPT>
|
|
|
Copyright © 1996-2008 irt.org, All Rights Reserved.