HTML Form Object

来源:互联网 发布:仿淘宝商城源码html 编辑:程序博客网 时间:2024/05/17 23:25

Form Object

The Form object represents an HTML form.

For each <form> tag in an HTML document, a Form object is created.

Forms are used to collect user input, and contain input elements like text fields, checkboxes, radio-buttons, submit buttons and more. A form can also contain select menus, textarea, fieldset, legend, and label elements.

Forms are used to pass data to a server.


Form Object Collections

W3C: W3C Standard.

CollectionDescriptionW3Celements[]Returns an array of all elements in a formYes

Form Object Properties

PropertyDescriptionW3CacceptCharsetSets or returns the value of the accept-charset attribute in a formYesactionSets or returns the value of the action attribute in a formYesenctypeSets or returns the value of the enctype attribute in a formYeslengthReturns the number of elements in a formYesmethodSets or returns the value of the method attribute in a formYesnameSets or returns the value of the name attribute in a formYestargetSets or returns the value of the target attribute in a formYes

Form Object Methods

MethodDescriptionW3Creset()Resets a formYessubmit()Submits a formYes

Form Object Events

EventThe event occurs when...W3ConresetThe reset button is clickedYesonsubmitThe submit button is clickedYes

Standard Properties, Methods, and Events

The Form object also supports the standard properties, methods, and events.

原创粉丝点击