已经知道窗口的名称,怎么做倒窗口的取得 window.open('your.htm','WinName')打开窗口时指定相同的名称(WinName)就行啦 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 不行的,因为使用了一样的窗口名称,虽然我设定了新的属性,比如大小,scrolling bar等等,但是都不会变化的,都是原来打开的时候的样子。怎么让他用新的我设定的属性呢? 可以在A窗口中定义一个变量var C1Window,当从A窗口中打开C1窗口时,用C1Window=window.open(...);表示,当C1窗口关闭时,调用self.opener.C1Window=null。这样当在B窗口中要打开C2时,只要判断A窗口中的C1Window是否为空就可以可以了。 定义一个变量COPEN=0,如果C1是打开的就,COPEN=1,再配合WINDOW.OPEN()就可以解决了! a=window.open()判断:if(a && a.open && !a.closed)a.focus() test1.htm--------------------------------------1<input type="button" value="open" onclick="test()"><script>var winFlag = Math.random();function test(){ var w = window.open('http://www.weiqi.net', 'haha', "height=100,width=100,status=yes,toolbar=no,menubar=no,location=no"); if (w.opener.winFlag != self.winFlag) { w.close(); window.open('http://www.weiqi.net', 'haha', "height=100,width=100,status=yes,toolbar=no,menubar=no,location=no"); }}</script>test2.htm--------------------------------2<br><input type="button" value="open" onclick="test()"><script>var winFlag = Math.random();function test(){ var w = window.open('http://www.weiqi.net', 'haha', "height=300,width=300,status=yes,toolbar=no,menubar=no,location=no"); if (w.opener.winFlag != self.winFlag) { w.close(); window.open('http://www.weiqi.net', 'haha', "height=300,width=300,status=yes,toolbar=no,menubar=no,location=no"); }}</script> 谢谢楼上的解答。我有一个问题,可不可以if (w.opener.winFlag != self.winFlag)--〉if (w.opener != self)这样的比较呢?假如可以的话,就不需要你的那个变量了。 inelm(木野狐) :其实,还有一个问题,就是,假如我关掉了你先打开的窗口的那个html,然后在执行你的余下的那个html,一样还是有问题的。和和。就是,1。打开test1.html;2。test2.html;3。点击test1.html上面的open按钮,然后关掉test1.html;4。点击test2.html上面的open按钮,这个时候javascript就有错误了。所以,我觉得,应该放一个变量到那个子窗口上面,通过那个变量来比较,这样可能是没有问题的。但是没有测试过。 ff下如何开启 window.status 有ie8, 且装有其他浏览器的同鞋帮忙改改代码兼容性. 高分 如何获取子元素? 新手幼稚问题? 如何判断scroll事件是否执行完毕。 求救,js 如何判断一个字符串是否在别一个字符串中? 急!!!在javascript中调用vbscript(在线等待) 怎么实现 鼠标在相片上时会显示相片的一些资料 footerFormatter中如果return的值包含'.'就不显示怎么办 怎么把让状态栏正常显示连接地址。大家都问隐藏,我相反,问怎么显示。 JScript中的数字类型问题,急,在线等
判断:
if(a && a.open && !a.closed)
a.focus()
--------------------------------------1
<input type="button" value="open" onclick="test()"><script>
var winFlag = Math.random();function test()
{
var w = window.open('http://www.weiqi.net', 'haha', "height=100,width=100,status=yes,toolbar=no,menubar=no,location=no");
if (w.opener.winFlag != self.winFlag)
{
w.close();
window.open('http://www.weiqi.net', 'haha', "height=100,width=100,status=yes,toolbar=no,menubar=no,location=no");
}
}
</script>
test2.htm
--------------------------------2
<br>
<input type="button" value="open" onclick="test()"><script>
var winFlag = Math.random();function test()
{
var w = window.open('http://www.weiqi.net', 'haha', "height=300,width=300,status=yes,toolbar=no,menubar=no,location=no");
if (w.opener.winFlag != self.winFlag)
{
w.close();
window.open('http://www.weiqi.net', 'haha', "height=300,width=300,status=yes,toolbar=no,menubar=no,location=no");
}
}
</script>
1。打开test1.html;
2。test2.html;
3。点击test1.html上面的open按钮,然后关掉test1.html;
4。点击test2.html上面的open按钮,这个时候javascript就有错误了。所以,我觉得,应该放一个变量到那个子窗口上面,通过那个变量来比较,这样可能是没有问题的。但是没有测试过。