关闭子窗口时,父窗口自动刷新 setTimeOut啊,没事干自己刷,管他开不开子呢。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 save as test.htm and test:<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>无标题文档</title></head><body onunload="if (opener) opener.location.reload()"><a href="test.htm" target="_blank">dxxxx</a><script>alert('hello,i\'m reloaded')</script></body></html> 原来LZ要求不能由子窗口控制,没看清题意,算我没说.呵呵那就每打开一个子窗口记下该窗口的变量,然后不停地用setInterval来测试该变量是否存在。以下省略代码n行。结尾再加一个注释:脱裤子打P 在窗口中判断打开的子窗口关闭没有,若关闭,则调用document.execCommand方法进行页面刷新.刚写的,只写了逻辑部分代码.代码如下:var windowList=[];function createWindow(){ var newWindow=window.open("http://ham.javaeye.com","_blank"); //将打开的窗口引用存入windowList数组中. windowList.push(newWindow); setInterval("checkClose()",1000);}function checkClose(){ for(var i=0;i<windowList.length;i++){ if(windowList[i].closed){ alert("刷新页面"); document.execCommand('Refresh'); ... //将打开的窗口对象从windowList中移除. ... return; } }} 我是这么做的父.asp 包含一个如下javascript语句即可 <script language="javascript"> function submit11() { self.location.replace("<%=Request.ServerVariables("script_name")%>"); } </script>子.asp 结尾用如下语句:<html><body onLoad="load2()"><script language="javascript"> function load2() { opener.setTimeout("submit11()",150) self.setTimeout("exit()",150) } function exit() { window.opener=null; window.open('','_self'); window.close(); }</script> </body></html>就OK了! 在子窗口的onUnload时间中调用如下代码:openner.document.location.reload(); onUnload时间中调用如下代码: opener.setTimeout("refreshfunction()",1);refreshfunction()函数为父窗口刷新 <script language="javascript"> var pages=new Array(); var i=0 function Inc(){ pages[i]= window.open("h2.html",'公司',"height=480,width=600,scrollbars=yes") pages[i].document.body.onunload=function(){ location.reload(); } i++; } //只能关闭第一个窗口时主页面刷新,因为主页面刷新后有关子窗口的信息丢失了。//所有onunload必须写在子窗口里面 </script> <input type="button" value="选择数据" id="Button4" onclick="return Inc();"> jquery 控制freetextbox控件的长度 父页如何获取iframe里的input的值 如何实现真正的Digg?关于web 2.0搜索讨论 js中取控件的值 100分求js解密程序~~`急急急!!!! 请问在IE中的document.body.insertAdjacentHTML( "beforend", str )方法,在netscape中应该怎么实现?在线等 简单JS读取xml问题 window.event 是什么对象啊? 怎么在网页没加载完时,显示其它信息?(如显示:正在加载数据!) 我要继续问帧的问题...... 请教一个js的问题 如何在一个网页中生成图形?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body onunload="if (opener) opener.location.reload()">
<a href="test.htm" target="_blank">dxxxx</a>
<script>alert('hello,i\'m reloaded')</script>
</body>
</html>
以下省略代码n行。结尾再加一个注释:脱裤子打P
刚写的,只写了逻辑部分代码.
代码如下:var windowList=[];
function createWindow(){
var newWindow=window.open("http://ham.javaeye.com","_blank");
//将打开的窗口引用存入windowList数组中.
windowList.push(newWindow);
setInterval("checkClose()",1000);
}
function checkClose(){
for(var i=0;i<windowList.length;i++){
if(windowList[i].closed){
alert("刷新页面");
document.execCommand('Refresh');
...
//将打开的窗口对象从windowList中移除.
...
return;
}
}
}
父.asp
包含一个如下javascript语句即可
<script language="javascript">
function submit11() {
self.location.replace("<%=Request.ServerVariables("script_name")%>");
}
</script>子.asp
结尾用如下语句:
<html>
<body onLoad="load2()">
<script language="javascript">
function load2() {
opener.setTimeout("submit11()",150)
self.setTimeout("exit()",150)
}
function exit() { window.opener=null;
window.open('','_self');
window.close();
}
</script>
</body>
</html>就OK了!
openner.document.location.reload();
opener.setTimeout("refreshfunction()",1);
refreshfunction()函数为父窗口刷新
var pages=new Array();
var i=0
function Inc(){
pages[i]= window.open("h2.html",'公司',"height=480,width=600,scrollbars=yes")
pages[i].document.body.onunload=function(){
location.reload();
}
i++;
}
//只能关闭第一个窗口时主页面刷新,因为主页面刷新后有关子窗口的信息丢失了。
//所有onunload必须写在子窗口里面
</script>
<input type="button" value="选择数据" id="Button4" onclick="return Inc();">