Syntax
document.forms document.forms[index]
The forms property is an array that contains all the forms that exist within the HTML document from using the
The forms property length contains the number of items in the array.
The index number ranges from zero to length - 1.
<html> <form name="Form1"> <input type="button" value="Green" onClick = "document.bgColor='green'"> </form> <form name="Form2"> <input type="button" value="Blue" onClick = "document.bgColor='blue'"> </form> <script language="JavaScript"> <!-- for(i=0;i<document.forms.length;i++) { document.write((i+1)); document.write(" . <i><b>",document.forms[i].name,"</b></i><br>"); } --> </script> </html>