2012-01-03 60 views
2

我有一個mainpage.html iframe標籤內的特定ID,該iframe調用back.html ..調用框架

有什麼辦法只調用back.html的特定ID在iframe中顯示..

詳細信息: 我在back.html中有25x25表。最初iframe顯示所有625個單元最小化。每個單元格都有一個唯一的ID。我可以調用特定的單元格來顯示iframe中的原始大小。

或有任何其他方式去解決它..請註明

+0

向我們顯示相關的HTML。根據你的話我完全不知道你在問什麼。 – jfriend00 2012-01-03 09:37:40

+0

你解決了嗎? – fcalderan 2012-01-05 08:51:19

回答

3

試試這個代碼:

var iframe = document.getElementById('your-iframe-ID'), 
       /* or other kind of reference to the iframe DOM node */ 

    iframeDoc = ((!!iframe['contentDocument']) 
       ? iframe.contentDocument 
       : iframe.contentWindow.document), 

    cell  = iframeDoc.getElementById('your-cell-ID'); 
       /* this is a reference to cell inside the iframe */ 

當然我認爲mainpage.htmlback.html在同一個域(爲same-origin政策)