大家好,小编来为大家解答以下问题,js设置文本框焦点,js 页面失去焦点,今天让我们一起来看看吧!
java:document.getElementById("id").focus();
或java:document.all.id.focus();
或java:document.all.name.focus();
例子:
<input type="text" name="tt" id="tt">
<input type="button" name="bt" id="bt" οnclick="java:document.all.tt.focus();" value="给文本框设焦点">var act = document.activeElement.id;//焦点在哪个控件上
转载于:https://www.cnblogs.com/wuchao/archive/2012/08/01/2618418.html