87,910
社区成员
发帖
与我相关
我的任务
分享
<script type="text/javascript">
function focustest(){
var inp=document.createElement("input");
inp.id="myinp";
inp.value="hahaha";
document.getElementById("create").appendChild(inp);
inp.focus();
}
</script>
<div id="create"></div>
<input type="button" onclick="focustest()" value="测试"/>
window.onload = function(){
document.getElementById('您文本框的id').focus();
}