function contents_nb(name, height) {
1. document.getElementById('contents_iframe').height = height+'px';
2. var $currentIFrame = $('#contents_iframe');
3. $currentIFrame.contents().find(".wrap_contents").hide();
4. $currentIFrame.contents().find(".greetings").fadeIn(2500);
}
这是我的jQuery语法。如何从父文档访问iframe中的元素?
no.1〜3,效果很好。
但第4行,它不起作用。
HTML文档中的iframe是结构...
<body>
<div class="wrap_contents">
<div class="greetings">
</div>
<div class="operational_philosophy">
</div>
</div>
</body>
</html>
的原因是什么?是什么导致这个问题?
和父html文件的语法是..
<iframe id="contents_iframe"></iframe>
是什么问题? 为什么在班级里找不到班级?
请邮寄普通的HTML – Barmar
你能告诉更多的代码,或把它的jsfiddle,包括链接? –
iframe的来源与父源的来源是否相同?如果不是这样,那么由于浏览器安全策略,您无法正常访问iframe内容 –