方法1:
<body onload="document.getElementById('inputId').focus()">方法2:
function init(){
document.getElementById("inputId").focus();
}
例如:
<body onload="document.getElementById('test').focus()">
我要获取焦点:<input type="text" name="test" id="test">
</body>
div等标签获取焦点绑定keypress等事件