假设我有一个文本框的 onFocus 事件。当用户按预期进入该框时,该事件会触发。但是似乎事件在选中框时触发,然后通过切换选项卡,打开然后关闭另一个应用程序等来覆盖然后打开窗口。有没有办法让它只触发事件选择(或单击鼠标)文本框,而不是通过覆盖然后打开窗口?
问问题
294 次
2 回答
0
您可以使用onClick
事件。不过,这只会触发点击事件,而不是标签。您还可以使用onKeyDown
which 会在任何按键时触发,但也会在用户从文本框移开时触发。
于 2011-09-03T18:14:16.410 回答
0
when one goes away from page, you may use window.document.onblur=function(){disable all onFocus};
and re activate them with window.document.onfocus=function(){enable all onFocus};
于 2011-09-03T20:46:52.287 回答