用IHTMLElementCollection解析带script的html文件,不能解析到
xlz45 2006-08-18 10:14:00 这是html内容:
<html>
<head>
<title>page title</title>
</head>
<script language="javascript">
function loaded()
{ var c = document.all.length;
var i;
for(i = 0; i < c; i++)
{
spantags.innerhtml = spantags.innerhtml + document.all.item(i).tagname + "<br>";
}
}
</script>
<body onload="">
<span id="spantags"></span>
</body>
</html>
解析html的代码段,发现不能解析到<script>后面的tag,get_length为4,应该是6
CComQIPtr<IHTMLDocument2, &IID_IHTMLDocument2> pDoc2;
CComPtr<IHTMLElement> pElement;
CComPtr<IHTMLElementCollection> pElementCol;
CComPtr<IHTMLElementCollection> pElementCol2;
pDoc2 = GetHtmlDocument();
HRESULT hr = pDoc2->get_all(&pElementCol);
long i;
pElementCol->get_length(&i);
请各位高手赐教,thx!