Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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?

irt.org | Knowledge Base | JavaScript | Form | Q1366 [ previous next ]

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?

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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.