document.forms : forms : Document JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Document » forms »

 

document.forms











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


tag.

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>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Document
» forms