autofocus

收藏:0   阅读:26

HTML <textarea> autofocus 属性

实例

一个自动获得焦点的文本区域:

<textarea autofocus>
在 bubuko.com 你将学会如何制作网站。我们提供了最全的web技术教程。
</textarea>


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer 10、Firefox、Opera、Chrome 和 Safari 支持 autofocus 属性。

注意:Internet Explorer 9 及之前的版本支持 <textarea> 标签的 autofocus 属性。


定义和用法

autofocus 属性是一个布尔属性。

autofocus 属性规定文本区域应该在页面加载时自动获得焦点。


HTML 4.01 与 HTML5之间的差异

autofocus 属性是 HTML5 中 <textarea> 标签的新属性。


HTML 与 XHTML 之间的差异

在 XHTML 中,禁止属性最小化,autofocus 属性必须定义为 <textarea autofocus="autofocus">。


语法

<textarea autofocus>
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!