2011-08-30 69 views
0

我使用的是框架頁,其中包含下面的JavaScript行:的Javascript top.location.replace有和沒有父母的iFrame

top.contentsFrame.location.replace("/main.jsp"); 

我想在iframe中運行這個頁面,以及independenty 。 在iFrame中它不起作用,因爲top屬性現在返回iFrame。所以它再也找不到「contentsFrame」了。

解決這個問題最簡單的方法是什麼?

乾杯!

回答

1

你應該使用

parent.top.location.replace("/main.jsp"); 
+0

不知道這是否會修復它,因爲在iFrame中使用時,頂部屬性點到不同的位置,所以我想它不會找到「contentsFrame」即可。 – user913346

相關問題