form object
form object
A
##Get form elements
- Get the object through the id of the web page element. document.getElementById(id)
- Get the object through the HTML tag name. parentNode.getElementsByTagName(tagName)
- Get the form element object through the name attribute. The starting point of all elements in the form must be a document object.
- Syntax: document.formObj.elementObj
- The access method is a three-tier structure. Among them, formObj represents the form object, and elementObj represents the form element object.
- Example: document.form1.username.value.length
##Event return value
The return value of the event will affect the default action of the object. For example: The default action of the tag is to open a URL.
If the event returns false, the execution of the default action is prevented; if the event returns true or empty, the default action continues to be executed.
php.cn PHP中文网
There are two events affected by the return value: onclick and onsubmit.