【发布时间】:2017-01-12 15:58:23
【问题描述】:
我要解析html字符串
<!DOCTYPE html><html><head></head><body>....<some tag></some tag>...<script> </script></body></html>
我该怎么做?
代码:
<iframe id="FileFrame" src="about:blank"></iframe>
<script>
var doc = document.getElementById('FileFrame').contentWindow.document;
doc.open();
doc.write('<!DOCTYPE html><html><head></head><body>....<some tag></some tag>...<script></script></body></html>');
doc.close();
</script>
【问题讨论】:
-
您的第一步应该始终是look in the documentation。
-
它不是静态的 html,它总是不同的。
-
@Geha - 这有什么关系?
-
我需要构建 dom 以插入 iframe。我尝试了很多选项,但我总是得到相同的结果,或者它没有显示所有网页,或者它在没有样式和脚本的情况下转换它
标签: javascript jquery html dom