English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Die autofocus Eigenschaft ist ein boolesches Attribut. Die autofocus Eigenschaft legt fest, dass das <input>-Element automatisch den Fokus erhalten soll, wenn die Seite geladen wird.
Wenn die Seite geladen wird, sollte das Feld name="fname" automatisch den Fokus erhalten:
<!DOCTYPE html> <html> <head> <title>HTML: <input> autofocus Eigenschaft - Grundlagen-Tutorial-Website(oldtoolbag.com)</title> <body> <form action="action_page.php"> Vorname: <input type="text" name="fname" autofocus><br> Nachname: <input type="text" name="lname"><br> <input type="submit"> </form> </body> </html>Test it out ‹/›
IEFirefoxOperaChromeSafari
Internet Explorer 10Firefox, Opera, Chrome and Safari support the autofocus attribute.
Note:Internet Explorer 9 and earlier versions do not support the autofocus attribute of the <input> tag.
The autofocus attribute is a boolean attribute.
The autofocus attribute specifies that the <input> element should automatically receive focus when the page is loaded.
The autofocus attribute is an HTML5 with the newly added attributes.
In XHTML, attribute shorthand is prohibited, the autofocus attribute must be defined as <input autofocus="autofocus" />。
<input autofocus>