加载页面时,如何让指定输入框默认获取焦点?
只需在body标签中加入onload属性即可,如下:
<body onload="document.getElementById('loginName').focus()">
......
<input type="text" id="loginName" name="loginName"/>
......
</body>
加载页面时,如何让指定输入框默认获取焦点?
只需在body标签中加入onload属性即可,如下:
<body onload="document.getElementById('loginName').focus()">
......
<input type="text" id="loginName" name="loginName"/>
......
</body>
转载于:https://www.cnblogs.com/xmm2017/p/8479399.html
512

被折叠的 条评论
为什么被折叠?