<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<meta http-equiv="content-type" content="text/html" charset="GB2312">
<link rel="stylesheet" type="text/css" href="">
<script type="text/javascript" src=""></script>
<script language="javascript" type="text/javascript">
var win0 = win2 = win3 = null;
function o1(id)
{
if (id == 'w1')
{
win0 = window.open('http://www.tom.com','',"toolbar=no,menubar=no,status=no,location=no,width=300,height=200");
return true;
}
else if (id == 'w2')
{
win2 = window.open('http://www.sohu.com','',"toolbar=no,menubar=no,status=no,location=no,width=300,height=200");
return true;
}
else if (id == 'w3')
{
win3 = window.open('http://www.yahoo.com.cn','',"toolbar=no,menubar=no,status=no,location=no,width=300,height=200");
return true;
}
}
function c()
{
window.opener = null;
win0.close();
win2.close();
win3.close();
window.close();
return true;
}
</script>
</HEAD><BODY>
<INPUT TYPE="button" NAME="" onclick="o1('w1');return true;" value="Open1!">
<INPUT TYPE="button" NAME="" onclick="o1('w2');return true;" value="Open2!">
<INPUT TYPE="button" NAME="" onclick="o1('w3');return true;" value="Open3!">
<INPUT TYPE="button" NAME="" onclick="c();return true;" value="Close All">
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<meta http-equiv="content-type" content="text/html" charset="GB2312">
<link rel="stylesheet" type="text/css" href="">
<script type="text/javascript" src=""></script>
<script language="javascript" type="text/javascript">
var win0 = win2 = win3 = null;
function o1(id)
{
if (id == 'w1')
{
win0 = window.open('http://www.tom.com','',"toolbar=no,menubar=no,status=no,location=no,width=300,height=200");
return true;
}
else if (id == 'w2')
{
win2 = window.open('http://www.sohu.com','',"toolbar=no,menubar=no,status=no,location=no,width=300,height=200");
return true;
}
else if (id == 'w3')
{
win3 = window.open('http://www.yahoo.com.cn','',"toolbar=no,menubar=no,status=no,location=no,width=300,height=200");
return true;
}
}
function c()
{
window.opener = null;
win0.close();
win2.close();
win3.close();
window.close();
return true;
}
</script>
</HEAD><BODY>
<INPUT TYPE="button" NAME="" onclick="o1('w1');return true;" value="Open1!">
<INPUT TYPE="button" NAME="" onclick="o1('w2');return true;" value="Open2!">
<INPUT TYPE="button" NAME="" onclick="o1('w3');return true;" value="Open3!">
<INPUT TYPE="button" NAME="" onclick="c();return true;" value="Close All">
</BODY>
</HTML>
解决方案 »
- 把json数据赋值给下拉框,下拉框值不能重复
- "<div id=1 abc=5></
- 便利Json的后的问题噢
- javascript all属性过时了,那么现在应该用什么代替它?
- 如何查找字符串里里面的反斜杠
- 关于jQuey代码不执行的问题
- 怎样实现新浪邮箱发邮件时的效果
- 有4到5组checkbox,怎样实现点击每组的第一个checkbox就选中这一组checkbox
- 老革命遇上新问题:有那位高收编过菜单的请帮忙解决呀
- target的问题???急切!!!target的父对象是什么?是window?还是document?还是什么???
- 在showModalDialog窗口中的链接为何不能加入收藏夹?
- 我想操作本地的文件,我该怎么做呢?
1:上述测试点"Close All"广告小窗口没有关闭;
S:解决方法:这在你自己开发中,可能没有这种嵌套打开,只要记录到打开对象,相应的也能关闭;2:如果重复点击,但前面打开的窗口没有关闭,则后打开的不能被关闭,
比方说第二个按钮点了两下,而第一次点击的没有关闭,当你最后点关闭父页面时,只能关闭两次打开当中的一个(第二次点开的);
S:解决方法:同样这类问题与1后半部类似,你只要动态的去记录每次打开的窗口的对象ID,关闭时逐个关闭即可;
--以上测试是在,winXP+IE6.0--
有更直接的办法吗?
*/
你是指,不去点关闭按钮直接就关闭?比方下面?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<meta http-equiv="content-type" content="text/html" charset="GB2312">
<link rel="stylesheet" type="text/css" href="">
<script type="text/javascript" src=""></script>
<script language="javascript" type="text/javascript">
var win0 = win2 = win3 = null;function o1(id)
{
if (id == 'w1')
{
win0 = window.open('http://www.tom.com','',"toolbar=no,menubar=no,status=no,location=no,width=300,height=200");
return true;
}
else if (id == 'w2')
{
win2 = window.open('http://www.sohu.com','',"toolbar=no,menubar=no,status=no,location=no,width=300,height=200");
return true;
}
else if (id == 'w3')
{
win3 = window.open('http://www.yahoo.com.cn','',"toolbar=no,menubar=no,status=no,location=no,width=300,height=200");
return true;
}
}function c()
{
window.opener = null;
win0.close();
win2.close();
win3.close();
window.close();
return true;
}
</script>
</HEAD><BODY onunload="return c();">
<INPUT TYPE="button" NAME="" onclick="o1('w1');return true;" value="Open1!">
<INPUT TYPE="button" NAME="" onclick="o1('w2');return true;" value="Open2!">
<INPUT TYPE="button" NAME="" onclick="o1('w3');return true;" value="Open3!">
</BODY>
</HTML>
var _aW=[];
function fInitW()
{
var aA=document.getElementsByTagName("A");
var aH;
for(var i=0;i<aA.length;i++)
{
try{ aH=aA[i].getAttribute("href") } catch(ex) {aH=null;};
if (aH && !(/javascript|jscript|vbscript|vbs|onclick/i).test(aH))
eval("aA[" + i + "].onclick=function() {_aW[_aW.length]=window.open('" + aH + "', '', '');event.returnValue=false;}")
else
aH=null;
}
}
function fClose()
{
for(var i=0; i<_aW.length; i++)
try {
window._aW[i].close();
} catch(e) { };
}
function fOpen()
{
_aW[_aW.length]=window.open("http://blog.csdn.net/blueDestiny", "","");
}
onload=function(){fInitW();}
</script>
<a href="http://www.never-online.net">open</a>
<a href="javascript:fClose()">close</a>
子窗口可能不是一级父子关系,可以是N级
在这种情况,我觉得采取逐层记录ID,利用每级页面本身的ONUNLOAD事件来完成递归多层子窗口的,这种方式对于一层子窗口的情况显然也是满足的具体可以利用变量记录由该页面的打开的窗口ID,当关闭该页面时,触发ONUNLOAD事件对变量记录的ID序列进行解析,关闭子窗口。每个窗口都用此方法,即产生归递效果
改成
set aa = window.open('xxx.asp','xx','参数')要不要set試下
關閉時用aa.close
set aa=nothing
set aa = window.open('xxx.asp','xx','参数')当关闭父窗口时,关闭即可:
function CloseOpen(){
aa.close();(或是aa.window.close(),我记不清了,不好意思!)
window.close();
}