💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# HTML DOM Button 对象 ## Button 对象 Button 对象代表 HTML 文档中的一个按钮。 该元素没有默认的行为,但是必须有一个 onclick 事件句柄以便使用。 在 HTML 文档中 <input type="button"> 标签每出现一次,一个 Button 对象 就会被创建。 您可以通过遍历表单的 elements[] 数组来访问某个按钮,或者通过使用 document.getElementById()。 ## Button 对象的属性 | 属性 | 描述 | | --- | --- | | [accessKey](/jsref/prop_button_accesskey.asp) | 设置或返回访问按钮的快捷键。 | | [alt](/jsref/prop_button_alt.asp) | 设置或返回当浏览器无法显示按钮时供显示的替代文本。 | | [disabled](/jsref/prop_button_disabled.asp) | 设置或返回是否禁用按钮。 | | [form](/jsref/prop_button_form.asp) | 返回对包含该按钮的表单对象的引用。 | | [id](/jsref/prop_button_id.asp) | 设置或返回按钮的 id。 | | [name](/jsref/prop_button_name.asp) | 设置或返回按钮的名称。 | | [tabIndex](/jsref/prop_button_tabindex.asp) | 设置或返回按钮的 tab 键控制次序。 | | [type](/jsref/prop_button_type.asp) | 返回按钮的表单元素类型。 | | [value](/jsref/prop_button_value.asp) | 设置或返回在按钮上显示的文本。 | ## 标准属性 | 属性 | 描述 | | --- | --- | | [className](/jsref/prop_classname.asp) | 设置或返回元素的 class 属性。 | | [dir](/jsref/prop_dir.asp) | 设置或返回文本的方向。 | | [lang](/jsref/prop_lang.asp) | 设置或返回元素的语言代码。 | | [title](/jsref/prop_title.asp) | 设置或返回元素的 title 属性。 | ## Button 对象的方法 | 方法 | 描述 | | --- | --- | | [blur()](/jsref/met_button_blur.asp) | 把焦点从元素上移开。 | | [click()](/jsref/met_button_click.asp) | 在某个按钮上模拟一次鼠标单击。 | | [focus()](/jsref/met_button_focus.asp) | 为某个按钮赋予焦点。 |