js中<input/>如何获得焦点?
展开全部
<script type="text/javascript" src="js/jquery-1.6.1.min.js"></script>
<script>
//<![CDATA[
window.onload = function(){
var oInput = document.getElementById("strName");
oInput.focus();
}
//]]>
</script>
</head>
<body>
用户名:<input type="text" id="strName" />
</body>
</html>
<script>
//<![CDATA[
window.onload = function(){
var oInput = document.getElementById("strName");
oInput.focus();
}
//]]>
</script>
</head>
<body>
用户名:<input type="text" id="strName" />
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询