关于 同时刷新2个frame的问题

sunzhenkui 2004-09-16 12:21:25
我有一个网页框架,里面有3个贞,我有一个按钮,在点击按钮的同时刷新两个贞,这个按钮可能在贞里,也可能在贞外,这个程序应该怎么写啊
...全文
143 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
memoriccell 2004-09-16
  • 打赏
  • 举报
回复
控制的js代码就在6.htm的里面:
<script language="javascript">
function test()
{
//这里是一个测试,你可以把地址改成你需要的页面地址,比如刷新原来的页面
//this.parent.fm4.fm2.location.href = "2.htm";
//this.parent.fm4.fm3.location.href = "3.htm";
this.parent.fm4.fm2.location.href = "http://www.csdn.net";
this.parent.fm4.fm3.location.href = "http://www.sina.com.cn";
}
</script>
memoriccell 2004-09-16
  • 打赏
  • 举报
回复
这个是4.htm的代码(这个页面包括两个子页面2.htm和3.htm):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<frameset rows="*,*">
<frame src="2.htm" name="fm2">
<frame src="3.htm" name="fm3">
</frameset><noframes></noframes>
</html>

子页面2.htm和3.htm的代码(这里是测试用的,你自己写的时候用自己的页面就行):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
</body>
</html>
memoriccell 2004-09-16
  • 打赏
  • 举报
回复
这个是主页面(5.htm),包含4.htm和6.htm两个页面:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="javascript">
function test()
{
//这里是一个测试,你可以把地址改成你需要的页面地址,比如刷新原来的页面
//this.parent.fm4.fm2.location.href = "2.htm";
//this.parent.fm4.fm3.location.href = "3.htm";
this.parent.fm4.fm2.location.href = "http://www.csdn.net";
this.parent.fm4.fm3.location.href = "http://www.sina.com.cn";
}
</script>
</head>

<body>
<input type="button" value="刷新" onClick="test()">
</body>
</html>

下面是6.htm的代码,控制刷新的代码在这个页面中:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="javascript">
function test()
{
//这里是一个测试,你可以把地址改成你需要的页面地址,比如刷新原来的页面
//this.parent.fm4.fm2.location.href = "2.htm";
//this.parent.fm4.fm3.location.href = "3.htm";
this.parent.fm4.fm2.location.href = "http://www.csdn.net";
this.parent.fm4.fm3.location.href = "http://www.sina.com.cn";
}
</script>
</head>

<body>
<input type="button" value="刷新" onClick="test()">
</body>
</html>
sunzhenkui 2004-09-16
  • 打赏
  • 举报
回复
随便帮我写个例子就可以了,我能看懂
memoriccell 2004-09-16
  • 打赏
  • 举报
回复
把你的框架代码贴上来看看
火电 2004-09-16
  • 打赏
  • 举报
回复

提供你思路:

县通过 脚本函数找到那个frame

然后再给frame得innerhtml 负值

使其刷新

87,902

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧