Overview
forms Returns a collection (an HTMLCollection object) containing all form elements in the current document.
grammar
var collection = document.forms;
example
Get form information
<script type="text/javascript"> $(function(){ var thisForm = document.forms['form1']; //Get the form form with name form1// or //var thisForm = document.forms[0]; //Get the first form form console.info(thisForm.username.value); //Output the username value with form name attribute value of form1 console.info(thisForm.address.value); document.forms[0].submit(); //Form submission}) </script><body> <!-- The following are three simple form forms--> <form action="x" name="form1" > <input type="text" name="username" value="zhangsan" /> <input type="text" name="address" value="beijing" /> </form> <form action="x" name="form2" > </form> <form action="x" name="form3" > </form> </body>