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

Q554 How can I determine if a checkbox on a form exists?

You are here: irt.org | FAQ | JavaScript | Form | 3.1 | Q554 [ previous next ]

Try:

<form name="myform">
<input type="checkbox" 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>

Shaun writes:

I found that I had to use the eval expresssion:

eval(document.formName.fieldName)

Feedback on 'Q554 How can I determine if a checkbox on a form exists?'

©2018 Martin Webb