DOM Input Checkbox

Checkbox 对象

The Checkbox object represents a checkbox in an HTML form. For each instance of an <input type="checkbox"> tag in an HTML form, a Checkbox object is created.
Checkbox对象可代表一个HTML表单中的checkbox(复选框)。每当有<input type="checkbox">标签出现在HTML表单,一个Checkbox对象就建立起来了。

You can access a Checkbox object by indexing the elements array (by number or name) of the corresponding form or by using getElementById().
你可以通过元素数组索引或是使用getElementById()来访问Checkbox对象。

IE: Internet Explorer, F: Firefox, N: Netscape, W3C: World Wide Web Consortium (互联网标准).

Checkbox 对象属性

Property
属性
Description
描述
IEFNW3C
acceptSets or returns a list of content types, which the server processing this form will handle correctly
设置或返回内容的类型,让服务器更准确的处理这个表单
-  Yes
accessKeySets or returns the keyboard key to access the checkbox
设置或返回能够访问这复选框的键盘按键。
4  Yes
alignSets or returns the alignment of the checkbox according to the surrounding text
设置或返回复选框相对周围文字的对齐方式
-  Yes
altSets or returns an alternate text to display if the browser does not support checkboxes
设置或返回对于那些无法支持checkbox浏览器的替换文字。
-  Yes
checkedSets or returns whether or not the checkbox is checked
设置或返回checkbox是否被选中了
312Yes
defaultCheckedSets or returns the default value of the checked attribute (true if checked by default and false if not)
设置或返回被选中属性的默认值(被默认的选中则为真,不然则为假)
312Yes
disabledSets or returns whether or not the checkbox should be disabled
设置或返回复选框是否应该禁用。
31 Yes
formReturns a reference to the form that contains the checkbox
返回包含checkbox表单的参考
312Yes
idSets or returns the id of the checkbox (In IE 4 this property is read-only)
设置或返回checkbox的id(在IE4中这个属性只读)
41 No
nameSets or returns the name of the checkbox
设置或返回checkbox的name
312Yes
tabIndexSets or returns the index that defines the tab order for the checkbox
设置或返回checkbox由tab顺序所定义的索引
4  Yes
typeReturns the type of the form element. For a checkbox it will be "checkbox"
返回表单元素类型,是checkbox的话就会返回为"checkbox"
413Yes
valueSets or returns the value of the value attribute of the checkbox
设置或返回checkbox属性的值
312Yes

标准属性

Property
属性
Description
描述
IE FOW3C
classNameSets or returns the class attribute of an element
设置或返回元素的class属性
519Yes
dirSets or returns the direction of text
设置或返回文字方向
519Yes
langSets or returns the language code for an element
设置或返回元素的代码语言
519Yes
titleSets or returns an element's advisory title
设置或返回元素的咨询标题
519Yes

Checkbox 对象方法

Method
方法
Description
描述
IEFNW3C
blur()Removes focus from the checkbox
删除checkbox的焦距
312Yes
click()Simulates a mouse-click in the checkbox
在checkbox中模仿鼠标点击
312Yes
focus()Gives focus to the checkbox
为checkbox加上聚焦
312Yes

Checkbox Object Events
checkbox对象事件

Syntax: object.event_name="someJavaScriptCode"
语法:对象.事件名 = "一些js代码"

Event
事件
Description
描述
IEFNW3C
onBlurExecutes some code when the checkbox loses focus
当checkbox失去聚焦的时候执行一些代码
312 
onClickExecutes some code when the checkbox is clicked
当checkbox被点的时候执行一些代码
312 
onFocusExecutes some code when the checkbox gets focus
当checkbox得到聚焦的时候执行一些代码
312 
onMouseDownExecutes some code when a mouse button is pressed
当鼠标按钮按住的时候执行一些代码
414 
onMouseUpExecutes some code when a mouse button is released
当鼠标按钮释放的时候执行一些代码
414 
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值