This section provides a number of features related to form operations, including the following sections, which can be invoked directly through the $ (element). Method () When the element is returned through the $ methods:
Form object: Provides some ways to manipulate an entire form
Form.element objects: Provides a way to manipulate a form element
Timedobserver class: Periodic form monitor that performs a callback function when the value of the form element changes, with form and element two types
Eventobserver class: Use events to monitor form elements and execute a callback function when the value of the form element changes, with form and element two types
Form.element object:
Focus (Element) Select (Element): The encapsulation of an HTML element's built-in method, in addition to returning the element itself
Serialize (Element): Serializes the specified form element, returns the form of Key=value, and the returned string is encodeURIComponent
GetValue (Element): Returns the value of an element
Clear (Element): Clears the value of an element
Present (Element): Determines whether the value of an element is not empty
Activate (Element): Get the element focus
Disable (Element): Making an element unavailable
Enable (Element): is elements available
The form objects include:
Reset (Form): Form.reset ()
SerializeElements (elements): Serializes the elements in elements to return the QueryString form of all specified elements for easy use in XMLHTTP or elsewhere
Serialize (form): Serializing an entire form
GetElements (Form): Returns all serializable elements of the form
Getinputs (Form, TypeName, name): Returns all input elements that conform to TypeName and name
Disable (Form): Make an entire form unavailable
Enable (form): Is the whole form available
Findfirstelement (Form): Returns the first available non-hidden element of type ' input ', ' select ', ' textarea '
Focusfirstelement (Form): Causes the element returned by Findfirstelement (form) to be focused
$F = Form.Element.getValue easy to use
Form.Element.Observer and Form.observer classes:
Periodically monitors form elements, and executes a callback function if the value of the form or form element changes, as follows:
var oser=new Form.Element.Observer (Element, frequency, callback)
or Oser=new form.observer (Form, frequency, callback)
Callback can define two parameters form/element, form.serialize ()/value
Form.Element.EventObserver and Form.eventobserver classes:
These two classes are similar to the above, but are not periodic monitoring, but instead use the element's change or click event to monitor the changes in the form element, executing callback When a change occurs, with the same parameters as above