开发者

How to place mouse cursor to certain input box

How ca开发者_如何学Cn I place the cursor automaticly to certain input box. This would help to not use the mouse all the time when open the page. (php and html)

Thank you!


<input name="input1" id="input1" value="" />

window.onload = init;

function init(){
document.getElementById("input1").focus();
}

This should do


window.onload = function(){
   document.getElementById("InputBoxID").focus();
};


Use the focus() method of the input on body.onLoad.


<input type="text" autofocus="autofocus" name="FirstName"/>

Text Field Get Focused When Page Gets Loaded..

For More Info, Check This Autofocus-Attribute Link

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜