这是一个很久以前的功能了。ajax流行时,被一些小朋友当成了ajax。其实都是js完成的。
其实,重点就是:你想刷新的页面的名字.location.reload(); 比如:打开者.父母.iframe名.location.reload();
框架页index.asp:
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<title>新建网页 1</title>
</head>
<frameset rows="64,*,19">
<frame name="top" scrolling="no" noresize target="contents" src="top.asp">
<frameset cols="150,*">
<frame name="contents" target="main" src="left.asp">
<frame name="main" src="right.asp">
</frameset>
<frame name="bottom" scrolling="no" noresize target="contents" src="bottom.asp">
<noframes>
<body>
<p>此网页使用了框架,但您的浏览器不支持框架。</p>
</body>
</noframes>
</frameset>
</html>
top.asp:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
<base target="contents">
</head>
<body>
<%=time()%>
</body>
</html>
leftp.asp:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 4</title>
<base target="main">
</head>
<body>
<%=time()%>
</body>
</html>
right.asp:(关键在这里)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>right</title>
</head>
<body>
<form method="POST">
<p align="center">
<input type="button" value="弹出新窗口(Opener),新窗口关闭后左侧框架页面自动刷新" name="B1" onclick="javascript:window.open('open.asp')"><br>
<input type="button" value="框架,点击后,底部的页面自动刷新" name="B2" onclick="javascript:parent.frames('bottom').document.location.reload();"><%=time()%><br>
以上功能仅适用于IE6或以上</p>
</form>
</body>
</html>
bottom.asp:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 3</title>
<base target="contents">
</head>
<body>
<%=time()%>
</body>
</html>
open.asp:关键在这里,不能加入“window.opener = null”,否则无效
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>open</title>
</head>
<body>
<p align="center">
<input type="button" value="点击后本窗口关闭,Opener的框架的左侧的页面自动刷新(仅适用于IE6以上)" name="B3" onclick="javascript:opener.parent.frames('contents').location.reload();window.close();"></p>
</body>
</html>
这篇博客介绍了如何使用JavaScript实现对opener窗口或指定iframe页面的自动刷新功能。通过设置onclick事件,分别展示了弹出新窗口关闭后使左侧框架页面刷新,以及点击按钮后使底部页面刷新的示例代码。此外,还提到了open.asp中关闭新窗口并刷新opener页面的技巧,强调该功能仅适用于IE6及以上版本。

108

被折叠的 条评论
为什么被折叠?



