Information about forms in HTML

高洛峰
Release: 2017-03-08 15:55:20
Original
1103 people have browsed it

In Javascript, each pair of

tags on the page is parsed into an object, the form object.

You can use document.forms to obtain a collection of all form objects in the document arranged in source order.


## ii> document.forms[0]; // According to the index numberiii> document.frm1; // Get the object directly based on the name value
If a form object is defined as follows:
Method to obtain the form object:
i> document. forms["frm1"]; // According to the name attribute value


##form form should pay attention to Properties:

elements: Gets a collection of all controls in the given form in source order. But the object is not in this collection.


#var txtName = myform.elements[0]; //Get the first element of the formvar txtName = myform.elements["txtName"]; //Get the element whose name attribute value is "txtName" var txtName = myform.elements.txtName; //Get the element whose name attribute value is "txtName"


# #enctype: Sets or gets the Multipurpose Internet Mail Extensions (MIME) encoding of the form.


                                                                                                                                                                   being ‐ being’s ’ s ’ s ’ s ’ s being being set to: multipart/form-data

##


Note: The maxlength in the multi-line text box