English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML tag大全

HTML keygen autofocus attribute

The keygen autofocus attribute is a boolean attribute, the autofocus attribute specifies that when the page is loaded, the <keygen> element will automatically focus.

 HTML <keygen> etiqueta

Online Example

Make the "Encryption" field automatically focused when the page is loaded:

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>基础教程网(oldtoolbag.com)</title> 
</head>
<body>
<form action="demo-frame.php" method="get">
  Username: <input type="text" name="usr_name">
  Encryption: <keygen name="security" autofocus>
  <input type="submit">
</form>
</body>
</html>
Teste e veja ‹/›

Compatibilidade do navegador

IEFirefoxOperaChromeSafari

Opera, Chrome e Safari 6 Suporte à propriedade autofocus da etiqueta <keygen>.

Definição e uso

A propriedade autofocus é um atributo booleano.

A propriedade autofocus define que o elemento <keygen> ganha o foco automaticamente ao carregar a página.

HTML 4.01 e HTML5diferenças entre

<keygen> é uma etiqueta do HTML5 com novas etiquetas.

Diferenças entre HTML e XHTML

No XHTML, é proibida a abreviação de atributos, a propriedade autofocus deve ser definida como <keygen autofocus="autofocus" />。

Sintaxe

<keygen autofocus>
 HTML <keygen> etiqueta