当前位置: 首页 > 网络学院 > 客户端脚本教程 > HTML DOM > DOM Input Checkbox

HTML DOM
DOM TableRow 对象
DOM Textarea 对象
DOM Window 对象

HTML DOM 中的 DOM Input Checkbox


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 789 ::
收藏到网摘: n/a

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

标准属性

Property
属性
Description
描述
IE  F O W3C
className Sets or returns the class attribute of an element
设置或返回元素的class属性
5 1 9 Yes
dir Sets or returns the direction of text
设置或返回文字方向
5 1 9 Yes
lang Sets or returns the language code for an element
设置或返回元素的代码语言
5 1 9 Yes
title Sets or returns an element's advisory title
设置或返回元素的咨询标题
5 1 9 Yes

Checkbox 对象方法

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

Checkbox Object Events
checkbox对象事件

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

Event
事件
Description
描述
IE F N W3C
onBlur Executes some code when the checkbox loses focus
当checkbox失去聚焦的时候执行一些代码
3 1 2  
onClick Executes some code when the checkbox is clicked
当checkbox被点的时候执行一些代码
3 1 2  
onFocus Executes some code when the checkbox gets focus
当checkbox得到聚焦的时候执行一些代码
3 1 2  
onMouseDown Executes some code when a mouse button is pressed
当鼠标按钮按住的时候执行一些代码
4 1 4  
onMouseUp Executes some code when a mouse button is released
当鼠标按钮释放的时候执行一些代码
4 1 4  

评论 (0) All

登陆 | 还没注册?