2011-09-05 62 views
0
<iframe name="aa"> 
    <iframe name="bb"> 
    </iframe> 
    <iframe name="cc"> 
    </iframe> 
</iframe> 

(假設如上所示的I幀擁有所有必需的屬性。)如何訪問幀中的幀?

我能在本地JavaScript NAME = 「AA」 幀的幀?
瀏覽器渲染它們,沒問題。
我試圖frame.frames來獲取內部幀的數組,其中幀是外部幀的幀對象,即「aa」。但它不起作用。
它甚至有可能嗎?
任何幫助?



非常感謝。

+2

我試着在FF iframe中找到的標籤aa amd cc分別呈現 和IE中的3個iframe分別呈現。 給我一些你的想法嗎? – Marwan

+1

我相信一個理智的瀏覽器不會顯示* bb *框架,因爲iframe不能嵌套在iframe中。 –

+0

@Salman A Okk我認爲我做錯了。在上面的情況下,它永遠不會在其他iframe中嵌套iframe。瀏覽器首先搜索正好是「bb」標籤的「aa」框架的標籤​​。這就是爲什麼「bb」標籤沒有呈現。 – EMM

回答

2

您可以這樣做,但是由於每個iframe在技術上都會加載另一個頁面,因此您必須將其編碼到第一個iframe正在加載的實際網頁中。

爲了進一步解釋...

<iframe name"aa"></iframe> <!-- this is coded into the first page calling the page below //--> 


<iframe name="bb"></iframe> <!-- coded into the second page calling another page //--> 
<iframe name="cc"></iframe> <!-- coded into the second page calling anothe page //--> 

記住,iframe會只是 「窗口」 到其他頁面。

+3

當然受到同源限制。 – sethobrien