首頁  >  問答  >  主體

javascript - 前端frame重新reload,為什麼一直報沒有location這個方法?

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>

#樓下各位的方法我都試過了,都不好用啊。 。 。 。 。


####
某草草某草草2637 天前941

全部回覆(6)我來回復

  • 为情所困

    为情所困2017-07-05 11:06:26

    問題終於解決:


    樓上各位提供的方法是基於當前頁面和要刷新的頁面同處於一個frameset,而我的這個頁面不在當前frameset所以無法跨域刷新,必須找到目標頁面所在的frameset才可以。

    回覆
    0
  • 大家讲道理

    大家讲道理2017-07-05 11:06:26

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

    回覆
    0
  • 为情所困

    为情所困2017-07-05 11:06:26

    getElementsByName 同學,請仔細讀方法名稱喲

    回覆
    0
  • 为情所困

    为情所困2017-07-05 11:06:26

    document.getElementsByName("framHeader")獲得的是一個陣列

    回覆
    0
  • 女神的闺蜜爱上我

    女神的闺蜜爱上我2017-07-05 11:06:26

    可以嘗試一哈這條語句document.getElementsByTagName('framHeader')[0].contentWindow.location.reload();

    回覆
    0
  • phpcn_u1582

    phpcn_u15822017-07-05 11:06:26

    叫你用那麼多 jquery,getElementsByName 回傳是陣列

    回覆
    0
  • 取消回覆