把窗口带到前面 [英] Bring window to front

查看:104
本文介绍了把窗口带到前面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能将非激活的(意味着另一个窗口位于该页面的前面)带到前面?
我试过self.focus和window.focus,但它不起作用...



我无法控制前面的窗口,因为它来自第三方插件...



非常感谢每一个提示:)

Greetz ,
Camillo



编辑:这里我在我的网站上使用的代码(即我试图带到前面):

 <!DOCTYPE html PUBLIC -  // W3C // DTD XHTML 1.0 Transitional // ENhttp://www.w3.org /TR/xhtml1/DTD/xhtml1-transitional.dtd\"> 
< html xmlns =http://www.w3.org/1999/xhtml>
< head>
< meta http-equiv =Content-Typecontent =text / html; charset = utf-8/>
< title>图库< /标题>
< script type =text / javascriptsrc =http://code.jquery.com/jquery-1.4.2.min.js>< / script>
< script type =text / javascript>
var timeFrame;
$(function(){timeFrame = setInterval(lpcAuto();,100);});
函数lpcAuto(){
if($(document.activeElement).attr('id')==lpcframe){

//这里是我的SNIPPET' M SEARCHING :)

}
}
< / script>


解决方案

另外请注意,浏览器这些日子有弹出式窗口拦截器阻止你这样做,而你必须禁用这些。


How can I bring a non-active (means another window is in front of that page) to the front? I've tried self.focus and window.focus, but it doesn't work...

I can't control the window in the front, because it's from a third-party plugin...

many thanks to every hint :)

Greetz, Camillo

EDIT: Here the code I'm using on my site (that i'm trying to bring to front):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Gallery</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
   var timeFrame;
   $(function() { timeFrame=setInterval("lpcAuto();", 100);});
   function lpcAuto(){
     if ( $(document.activeElement).attr('id')=="lpcframe" ){

// HERE THE SNIPPET I'M SEARCHING :)

}
   }
</script>

解决方案

First, you have to call blur() on the window that is on top. Then call focus() on the window that you want to call to the top.

Also note that browsers these days have popup blockers that prevent you from doing this, and you must disable these.

这篇关于把窗口带到前面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆