在帧内调用特定的id [英] Calling a specific id inside a frame
问题描述
我在mainpage.html中有一个iframe标记,iframe调用back.html ..
I have a iframe tag in mainpage.html, that iframe calls back.html..
有没有办法只调用back.html中的特定ID用于在iframe中显示..
is there any way to call only the specific ids in back.html for display in iframe..
详细信息:
我在back.html中有25x25表。最初,iframe显示所有625个细胞最小化。每个单元格都有唯一的ID。我可以调用特定的单元格来显示iframe内部的原始尺寸。
Detail: I have 25x25 table in back.html. initially iframe shows all 625 cells minimised. each cell has a unique id. can i call a specific cell only to display(original size) inside iframe.
还是有其他方法可以解决它...请注明
or is there any other way to go around it.. please specify
推荐答案
试用此代码:
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.html
和 back.html
位于同一个域中(对于同源政策)
Of course I assume that mainpage.html
and back.html
are in the same domain (for the same-origin policy)
这篇关于在帧内调用特定的id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!