html5 button autofocus 属性介绍及应用
在html 5中,可以设置当页面加载时,自动焦点到达某个控件中,这个就是autofocus属性了,如下:
<input autofocus="autofocus" />
<button autofocus="autofocus">hi!</button>
<textarea autofocus="autofocus"></textarea>
浏览器支持该属性的有:
fiefox 4+,safari 5+,chrome 6+,opera 11+,ie 10, 而android 2.3和safari mobile 5-都不支持
实例 当页面加载时,会获得焦点的一个按钮:
<button type="button" autofocus="autofocus">
点击这里
</button>
亲自试一试
定义和用法
autofocus 属性规定当页面加载时按钮应当自动地获得焦点。
如果使用该属性,则按钮会获得焦点。
html 4.01 与 html 5 之间的差异
autoplay 属性是 html 5 中的新属性。
语法
<button autofocus="autofocus">
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
-
-
前端的cookie
前端的cookie先自己总结一下(课本的相关具体细节看后面)先提一下:一定不要在 cookie 中存储重要和敏感...
[阅读全文]
-
-
-
-
-
-
-
-
网友评论