2022-06-11 573
HTML <input> autofocus 属性,自动获得焦点,背景高亮等
HTML <input> 标签
实例
设置 "First name" 输入字段在页面加载时自动获得焦点:
<form action="demo_form.html"> First name: <input type="text" name="fname" autofocus><br> Last name: <input type="text" name="lname"><br> <input type="submit"> </form>
注意:Internet Explorer 9 及之前的版本不支持 <input> 标签的 autofocus 属性。
定义和用法
autofocus 属性是一个布尔属性。
autofocus 属性规定当页面加载时 <input> 元素应该自动获得焦点。
HTML 4.01 与 HTML5之间的差异
autofocus 属性是 HTML5 中的新属性。
HTML 与 XHTML 之间的差异
在 XHTML 中,禁止属性最小化,autofocus 属性必须定义为 <input autofocus="autofocus" />。
语法
<input autofocus>
原文链接:https://77isp.com/post/1151.html
=========================================
https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。
数据库技术 2022-03-28
网站技术 2022-11-26
网站技术 2023-01-07
网站技术 2022-11-17
Windows相关 2022-02-23
网站技术 2023-01-14
Windows相关 2022-02-16
Windows相关 2022-02-16
Linux相关 2022-02-27
数据库技术 2022-02-20
抠敌 2023年10月23日
嚼餐 2023年10月23日
男忌 2023年10月22日
瓮仆 2023年10月22日
簿偌 2023年10月22日
扫码二维码
获取最新动态