我有这样的一个东西:
<!doctype html>
<html>
<body>
<iframe id="someFrame"></iframe>
</body>
</html>
我希望使用 jQuery 编写元素,使得最终的 HTML 等价于以下代码:
<!doctype html>
<html>
<body>
<iframe id="someFrame">
<!-- inside the iframe's content -->
<!-- <html><body> -->
<div>A</div>
<div>B</div>
<div>C</div>
<!-- </body></html> -->
</iframe>
</body>
</html>
另外,任何纯JavaScript都可以。
谢谢。
编辑:经过更多的研究,似乎我正在寻找一个IE版本的iframe的contentDocument属性。 "contentDocument"是一个W3C标准,FF支持它,但IE不支持。(意料之中的惊喜)
ifrm.contentDocument.document.document
? - ars265