急急急,怎么用呢,那个参数Ipdiapath怎么使用。如何获得子节点的个数和值?
parrentNode->get_children(???);
/* 获取字节点的类型,值等等操作 */
上面的如何做?

解决方案 »

  1.   

    补充点:
    网页上是这样的:
    <div><input value='1' type='radio'></input>10%</div>
    <div><input value='2' type='radio'></input>20%</div>我现在已经获得了input元素节点的IHTMLElement,现在想获得10%的那个文本节点值。怎么得到呢?
      

  2.   

    1、再用pParentElement-> get_children(&pDispatch);
    2、用QueryInterface(IID_IHTMLElementCollection,(void**)&pElements);
    3、最后用pElements-> item进行逐个遍历。
      

  3.   

    我的代码是这样的,去掉了错误判断如下:element为当前的input的IHTMLElement
    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啊。
    不解,继续求助
      

  4.   

    if(parentElement->get_innerText(&bs)==S_OK)
    {
    CString sa(bs);
    }
      

  5.   

    input后的文本,如果有<span..>%10</span>那么<span是input的兄弟节点文本可能是没有节点,它归属它的父项
      

  6.   

    查询input标签的IHTMLInputElement接口。
    然后使用:
    IHTMLInputElement::value Property