ThinkSSL🔒 一键申购 5分钟快速签发 30天无理由退款 购买更放心 广告
# HTML DOM Checkbox 对象 ## Checkbox 对象 Checkbox 对象代表一个 HTML 表单中的 一个选择框。 在 HTML 文档中 <input type="checkbox"> 每出现一次,Checkbox 对象就会被创建。 您可以通过遍历表单的 elements[] 数组来访问某个选择框,或者通过使用 document.getElementById() 。 ## Checkbox 对象的属性 | 属性 | 描述 | | --- | --- | | [accessKey](/jsref/prop_checkbox_accesskey.asp) | 设置或返回访问 checkbox 的快捷键。 | | [alt](/jsref/prop_checkbox_alt.asp) | 设置或返回不支持 checkbox 时显示的替代文本。 | | [checked](/jsref/prop_checkbox_checked.asp) | 设置或返回 checkbox 是否应被选中。 | | [defaultChecked](/jsref/prop_checkbox_defaultchecked.asp) | 返回 checked 属性的默认值。 | | [disabled](/jsref/prop_checkbox_disabled.asp) | 设置或返回 checkbox 是否应被禁用。 | | [form](/jsref/prop_checkbox_form.asp) | 返回对包含 checkbox 的表单的引用。 | | [id](/jsref/prop_checkbox_id.asp) | 设置或返回 checkbox 的 id。 | | [name](/jsref/prop_checkbox_name.asp) | 设置或返回 checkbox 的名称。 | | [tabIndex](/jsref/prop_checkbox_tabindex.asp) | 设置或返回 checkbox 的 tab 键控制次序。 | | [type](/jsref/prop_checkbox_type.asp) | 返回 checkbox 的表单元素类型。 | | value | 设置或返回 checkbox 的 value 属性的值 | ## 标准属性 | 属性 | 描述 | | --- | --- | | [className](/jsref/prop_classname.asp) | 设置或返回元素的 class 属性。 | | [dir](/jsref/prop_dir.asp) | 设置或返回文本的方向。 | | [lang](/jsref/prop_lang.asp) | 设置或返回元素的语言代码。 | | [title](/jsref/prop_title.asp) | 设置或返回元素的 title 属性。 | ## Checkbox 对象的方法 | 方法 | 描述 | | --- | --- | | [blur()](/jsref/met_checkbox_blur.asp) | 从 checkbox 上移开焦点。 | | [click()](/jsref/met_checkbox_click.asp) | 模拟在 checkbox 中的一次鼠标点击。 | | [focus()](/jsref/met_checkbox_focus.asp) | 为 checkbox 赋予焦点。 |