我想解析HTML字符串如何解析HTML字符串,DOM使用jQuery
<!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>
您的**第一步**应始终是[查看文档](http://api.jquery.com/jQuery.parseHTML/)。 –
它不是静态的html,它总是不同的。 – Geha
@Geha - 这与什么有关? – evolutionxbox