急急急,IHTMLElement::get_children函数怎么用 急急急,怎么用呢,那个参数Ipdiapath怎么使用。如何获得子节点的个数和值?parrentNode->get_children(???);/* 获取字节点的类型,值等等操作 */上面的如何做? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 补充点:网页上是这样的:<div><input value='1' type='radio'></input>10%</div><div><input value='2' type='radio'></input>20%</div>我现在已经获得了input元素节点的IHTMLElement,现在想获得10%的那个文本节点值。怎么得到呢? 1、再用pParentElement-> get_children(&pDispatch);2、用QueryInterface(IID_IHTMLElementCollection,(void**)&pElements);3、最后用pElements-> item进行逐个遍历。 我的代码是这样的,去掉了错误判断如下:element为当前的input的IHTMLElementCComPtr<IHTMLElement> parentElement;CComPtr<IHTMLElementCollection> elementCollection;CComPtr<IDispatch> pDispatch;VARIANT value;long length;element->get_parentElement(&parentElement);parentElement->get_children(&pDispatch);pDispatch->QueryInterface(IID_IHTMLElementCollection, (VOID**)&elementCollection);elementCollection->get_length(&length);for (INT i = 0; i < length; i++){ IDispatch *pDispInputText = NULL; CComVariant vIndex=i; elementCollection->item(vIndex,vIndex,&pDispInputText); CComPtr<IHTMLElement> pElemInputText; hr=pDispInputText->QueryInterface(IID_IHTMLElement,(void**)&pElemInputText);}上面得到的length是1,而最后得到的pElemInputText还是当前input的IHTMLElement,没能得到其后的文本节点。input后的文本节点应该是他的兄弟节点啊,可是为什么get_length只能得到1?至少应为2啊。不解,继续求助 if(parentElement->get_innerText(&bs)==S_OK){CString sa(bs);} input后的文本,如果有<span..>%10</span>那么<span是input的兄弟节点文本可能是没有节点,它归属它的父项 查询input标签的IHTMLInputElement接口。然后使用:IHTMLInputElement::value Property 在VC++工程中链接cximage.lib文件后,运行结果只有空白对话框,知道的帮帮忙!谢谢! SetParent改变父窗口后GetParent依然没变? error RC2135 : file not found: xx.tlb 如何将unicode码转换ascii码? 能发给我一个 CString包 在拨号得服务端如何检测当前是否有拨入的连接? ODBC API数据库函数的问题,哥哥姐姐不令赐教!???! MFC Ribbon 按钮背景颜色 CLisrCtrl的新问题。 怎样在作好的菜单下追加菜单. 关于在MFC中统一大小显示jpg图片问题! 怎么获取ListCtrl中选中时的背景色
网页上是这样的:
<div><input value='1' type='radio'></input>10%</div>
<div><input value='2' type='radio'></input>20%</div>我现在已经获得了input元素节点的IHTMLElement,现在想获得10%的那个文本节点值。怎么得到呢?
2、用QueryInterface(IID_IHTMLElementCollection,(void**)&pElements);
3、最后用pElements-> item进行逐个遍历。
CComPtr<IHTMLElement> parentElement;
CComPtr<IHTMLElementCollection> elementCollection;
CComPtr<IDispatch> pDispatch;
VARIANT value;
long length;element->get_parentElement(&parentElement);
parentElement->get_children(&pDispatch);
pDispatch->QueryInterface(IID_IHTMLElementCollection, (VOID**)&elementCollection);
elementCollection->get_length(&length);
for (INT i = 0; i < length; i++)
{
IDispatch *pDispInputText = NULL;
CComVariant vIndex=i;
elementCollection->item(vIndex,vIndex,&pDispInputText);
CComPtr<IHTMLElement> pElemInputText;
hr=pDispInputText->QueryInterface(IID_IHTMLElement,(void**)&pElemInputText);
}上面得到的length是1,而最后得到的pElemInputText还是当前input的IHTMLElement,没能得到其后的文本节点。
input后的文本节点应该是他的兄弟节点啊,可是为什么get_length只能得到1?至少应为2啊。
不解,继续求助
{
CString sa(bs);
}
然后使用:
IHTMLInputElement::value Property