Sumaster.NET


Maybe its not fast,but its simple.
  首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

如何使一个窗口强制激活在最前端并且可以填写表单?

Posted on 2005-06-16 16:29  本能  阅读(470)  评论(0)    收藏  举报

Q1398 How do I keep a pop-up window forced always active and in front, yet allow users to enter values in form fields?
Submitted by Ben Crosson:

There seem to be 5 or 6 entries in this FAQ which imply that this isn't possible. They simply suggest putting onBlur="self.focus()" in the body tag. However, this locks users out from entering information into form fields. It is possible to get around this though. Simply put the follwing 2 functions in the header of your page, and then in the body tag, as well as in the tag of every form field, put onBlur="blurred()" onFocus="focused()". This will solve this often complained about problem.

<script language="JavaScript">
var timer = '';
function blurred() {
    timer = setTimeout('self.focus()',1);
}

function focused() {
    if (timer != '')
        clearTimeout(timer);
}
</script>

摘自:
http://www.irt.org/script/1398.htm