HTML Form Object

本文详细介绍了HTML中的Form对象,包括其属性、方法和事件等内容。Form对象用于收集用户输入,涉及表单元素如文本框、复选框等,并解释了如何通过编程方式设置和获取这些元素的属性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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.

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

Form Object Properties

PropertyDescriptionW3C
acceptCharsetSets or returns the value of the accept-charset attribute in a formYes
actionSets or returns the value of the action attribute in a formYes
enctypeSets or returns the value of the enctype attribute in a formYes
lengthReturns the number of elements in a formYes
methodSets or returns the value of the method attribute in a formYes
nameSets or returns the value of the name attribute in a formYes
targetSets or returns the value of the target attribute in a formYes

Form Object Methods

MethodDescriptionW3C
reset()Resets a formYes
submit()Submits a formYes

Form Object Events

EventThe event occurs when...W3C
onresetThe reset button is clickedYes
onsubmitThe submit button is clickedYes

Standard Properties, Methods, and Events

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值