【发布时间】:2016-05-29 05:02:47
【问题描述】:
我有一个这样的框架集:
<frameset rows="120px,100%">
<frame name="top" id="top" src="top.php" noresize frameborder="0" scrolling="no" />
<frame name="main" id="main" src="main.php" noresize frameborder="0" scrolling="yes" />
在我的 main.php 文件中:
<script>
function reload_top() {
top.frames['top'].location.href= "http://www.google.com";
}
</script>
而main.php主体的onload事件为:
<body onload="reload_top();">
我想要实现的是,每次有人加载 main.php 时,该文件都会从顶部重新加载顶部框架 top.php,但到目前为止我只能让它脱离框架集并加载一个新页面...
我已经尝试过以下任何一种:
document.getElementById('top').src = "http://www.google.com";
window.top.location.href = "http://www.google.com";
top.frames['top'].location.href= "http://www.google.com";
它们都不起作用。 我做错了什么?
谢谢
【问题讨论】:
标签: javascript php onload frames