HTML button的属有:autofocus、disabled、form、formaction、formenctype、formmethod、formnovalidate、formtarget、name、type、value。

本教程操作环境:windows7系统、HTML5版、Dell G3电脑。

HTML标签

标签定义一个按钮。

在 button 元素内部,您可以放置内容,比如文本或图像。这是该元素与使用 input 元素创建的按钮之间的不同之处。

控件 与相比,提供了更为强大的功能和更丰富的内容。与标签之间的所有内容都是按钮的内容,其中包括任何可接受的正文内容,比如文本或多媒体内容。例如,我们可以在按钮中包括一个图像和相关的文本,用它们在按钮中创建一个吸引人的标记图像。

唯一禁止使用的元素是图像映射,因为它对鼠标和键盘敏感的动作会干扰表单按钮的行为。

请始终为按钮规定 type 属。Internet Explorer 的默认类型是 "button",而其他浏览器中(包括 W3C 规范)的默认值是 "submit"。

HTML标签的属

描述
autofocus autofocus 规定当页面加载时按钮应当自动地获得焦点。
disabled disabled 规定应该禁用该按钮。
form form_id 规定按钮属于一个或多个表单。
formaction URL 规定当提交表单时向何处发送表单数据。覆盖 form 元素的 action 属。该属与 type="submit" 配合使用。
formenctype application/x-www-form-urlencoded
multipart/form-data
text/plain
规定在向服务器发送表单数据之前如何对其进行编码。覆盖 form 元素的 enctype 属。该属与 type="submit" 配合使用。
formmethod get
post
规定用于发送表单数据的 HTTP 方法。覆盖 form 元素的 method 属。该属与 type="submit" 配合使用。
formnovalidate formnovalidate 如果使用该属,则提交表单时不进行验证。覆盖 form 元素的 novalidate 属。该属与 type="submit" 配合使用。
formtarget _blank
_self
_parent
_top
framename
规定在何处打开 action URL。覆盖 form 元素的 target 属。该属与 type="submit" 配合使用。
name name 规定按钮的名称。
type button
reset
submit
规定按钮的类型。
value text 规定按钮的初始值。可由脚本进行修改。

推荐内容