HTML <button> autofocus 属性
标签" href="tag-main.html"><main>
<map>
<mark>
<menu>
<meta>
<meter>
<nav>
<noframes>
<noscript>
<object>
<ol>
<optgroup>
<option>
<output>
<p>
<param>
<pre>
<html>
<picture>
<progress>
<q>
<rp>
<rt>
<ruby>
<s>
<samp>
<script>
<section>
<select>
<small>
<source>
<span>
<strike>
<strong>
<style>
<sub>
<summary>
<sup>
<table>
<tbody>
<td>
<textarea>
< template>
<tfoot>
<th>
<thead>
<time>
<title>
<tr>
<track>
<tt>
<u>
<ul>
<var>
<video>
<wbr>
HTML <button> autofocus 属性
实例
按钮使用 autofocus 属性:
<button type="button" autofocus>点我!</button>
浏览器支持
Internet Explorer 10, Firefox, Chrome, 和 Safari 支持autofocus 属性。
注意: Internet Explorer 9 以及更早IE版本不支持 autofocus 属性。
定义和用法
autofocus 属性是一个 boolean(布尔) 属性。
autofocus 属性规定当页面加载时按钮应当自动地获得焦点。
HTML 4.01 与 HTML5之间的差异
autofocus 属性是 HTML5 <button> 标签的新属性。
HTML 与 XHTML之间的差异
在 XHTML 中, 不允许属性简写,autofocus 属性必须定义为 <button autofocus="autofocus">。
语法
<button type="button" autofocus>
HTML <button> 标签