javascript - 前端frame重新reload,为什么一直报没有location这个方法?
某草草
某草草 2017-07-05 11:04:26
0
6
938

1,我的页面结构是这样的:

    <frameset rows="72,*,16" border="1" framespacing="0" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
    <frame name="framHeader" src="top.aspx" scrolling="no" border="0" frameborder="no" noresize topmargin="0" leftmargin="0" marginheight="0" marginwidth="0"></frame>
    <frameset name="framMain" cols="250,*" border="0" frameborder="0" framespacing="1" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
        <frame name="framLeft" src="Left.html" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" frameborder="0" scrolling="no" noresize></frame>
        <frame name="framRight" src="right.html" frameborder="0" bordercolor="#e4e4e4" noresize></frame>
    </frameset>
    <frame name="framFooter" src="foot.html" marginwidth="0" marginheight="0" frameborder="no" scrolling="no" noresize>
</frameset>
    <noframes></noframes>

2,登录后framRight跳转到welcome.aspx,现在想在welcome.aspx中刷新top.aspx,以便使得登录名可以显示在top.aspx中
但是怎么弄都无效,求高手帮助。
我的写法:
登录后在welcome.aspx中:

<p>
    <script>
        document.getElementsByName("framHeader").window.location.reload();
    </script>
</p>

楼下各位的方法我都试过了,都不好用啊。。。。。


某草草
某草草

全部回复(6)
为情所困

问题终于解决:

<script>

window.parent.parent.frames["framHeader"].window.location.reload();

</script>
楼上各位提供的方法是基于当前页面和要刷新的页面同处于一个frameset,而我的这个页面不在当前frameset所以无法跨域刷新,必须找到目标页面所在的frameset才可以。

大家讲道理

document.getElementsByName("framHeader")[0].window.location.reload();

为情所困

getElementsByName 同学,请仔细读方法名哟

为情所困

document.getElementsByName("framHeader")获得的是一个数组

女神的闺蜜爱上我

可以尝试一哈这条语句document.getElementsByTagName('framHeader')[0].contentWindow.location.reload();

phpcn_u1582

叫你用那么多 jquery,getElementsByName 返回是数组

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!