HTML <keygen> 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 <keygen> autofocus 属性
实例
让 "Encryption" 字段在页面加载时自动获得焦点:
<form action="demo_keygen.html" method="get">
Username: <input type="text" name="usr_name">
Encryption: <keygen name="security" autofocus>
<input type="submit">
</form>
浏览器支持
Opera、Chrome 和 Safari 6 支持 <keygen> 标签的 autofocus 属性。
定义和用法
autofocus 属性是一个布尔属性。
autofocus 属性规定当页面加载时,<keygen> 元素会自动获得焦点。
HTML 4.01 与 HTML5之间的差异
<keygen> 标签是 HTML5 中的新标签。
HTML 与 XHTML 之间的差异
在 XHTML 中,禁止属性最小化,autofocus 属性必须定义为 <keygen autofocus="autofocus" />。
语法
<keygen autofocus>
HTML <keygen> 标签