我的DOM如下。
<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", parent.document).attr("id");
顺便说一句,谢谢所有回答并通过宝贵评论帮助我的人。