1.自动获取焦点
<html>
<head>
</head>
<body>
username:<input type="text" id="username" name="username" autofocus="autofocus"/><br/>
<!--autofocus -->
password:<input type="text" id="password" name="password"/><br/>
<input type="submit" name="submitBtn" value="提交" autofocus />
</body>
</html>
2.js获取焦点
document.getElementById(‘password’).fucus();
或document.querySelector("#password").fucus();
2万+

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



