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

Q1366 How can I determine the subscript in the forms array when I only have a reference to the form and not the name of the form?

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

Try:

<script language="JavaScript"><!--
function computeRow(what) {
    for (var i=0;i<document.forms.length;i++)
        if (document.forms[i] == what)
            alert('We have a match : ' +i);
}
//--></script>


<form>
<input type="text" onChange="computeRow(this.form)">
</form>

<form>
<input type="text" onChange="computeRow(this.form)">
</form>

©2018 Martin Webb