Document.forms usage details
1.1 Overview
document.forms returns a collection (an HTMLCollection object) that contains all form elements in the current document.
1.2 Grammar
document.forms: means to get all the form elements of the current page;
document.forms[0]: means to get the first form element of the current page;
document.forms['exportServlet']: means to get the name=" in the current page exportServlet" form element;
document.forms.submit()/document.forms[0].submit()
/document.forms['exportServlet'].submit(): Indicates the submit function.
1.3 Instance
Instance - Get form information and submit.
$(function(){ var thisForm = document.forms[0]; console.info(thisForm.username.value); console.info(thisForm.address.value); document.forms[0].submit(); })
<body> <form name="form1" > <input type="text" name="username" value="zhangsan" /> <input type="text" name="address" value="beijing" /> </form> <form name="form2" > </form> <form name="form3" > </form> </body>