【发布时间】:2016-12-26 18:34:16
【问题描述】:
我的 DOM 如下。
<html><head>...</head><body><script>...</script>
<iframe id="frame">
#document
<html>...</html> <!-- 2 -->
</iframe>
</body>
</html>
我在iframe(即html 2)中绑定了部分内容。在 html_2 部分中,我调用document.ready 以使用iframe 获取id 使用getElementById,但我得到null。如何获取iframe的id等属性值?
【问题讨论】:
-
第一:你为什么使用 iframe?
-
使用getElementById获取iframe的id???您在 getElementById 中使用什么 id 来获取 id 为“frame”的 iframe?
-
My html is as below.不,它不是,保证 - 那可能是你的 DOM,而不是你的 html
标签: javascript jquery html iframe