HTML DOM Input URL autofocus attribute
Examples
See URL field is automatically get the focus when the page is loaded:
var x = document.getElementById("myURL").autofocus;
x The output is: true
try it"
Definition and Usage
autofocus property sets or returns the URL field is automatically get the focus when the page loads.
This property reflects the HTML autofocus property.
Browser Support
All major browsers support the autofocus attribute
Note: Internet Explorer 9 and earlier versions of IE or Opera 12 or earlier version of Opera browser does not support autofocus attribute.
Note: Internet Explorer or Safari browser does not support the use of type = "url" attribute of the HTML <input> elements.
grammar
Back autofocus properties:
urlObject .autofocus
Setting autofocus properties:
urlObject .autofocus=true|false
Property Value
值 | 描述 |
---|---|
true|false |
描述了 URL 字段在页面加载后是否获取焦点
|
technical details
return value: | Boolean value that, if the page URL field is automatically get the focus after loading returns true, otherwise returns false. |
---|
Related Pages
HTML Reference Manual: HTML <the INPUT> The autofocus attribute
Input URL objects