我的DOM如下。从父标记中获取元素ID
<html><head>...</head><body><script>...</script>
<iframe id="frame">
#document
<html>...</html> <!-- 2 -->
</iframe>
</body>
</html>
我在iframe
(即html 2)中绑定了部分内容。在html_2部分,我打电话document.ready
得到id
的iframe
使用getElementById
,但我得到null
。如何获得iframe
的id和其他属性值?
第一:你为什么要使用iframe? – madalinivascu
http://stackoverflow.com/questions/5864505/javascript-get-iframe-id-within-loaded-page –
使用getElementById获取iframe的ID?您在getElementById中使用什么ID来获取iframe,其ID是“frame”? –