追蹤
跟著傑森去旅行
關於部落格
一位熱愛旅行、拍照和嚐美食的玩家,跟你一同分享生活中有趣的發現。
  • 32248

    累積人氣

  • 1

    今日人氣

    1

    追蹤人氣

IHTMLDOMNode.attributes

function TForm1.DoAttributes(aNode: IHTMLDOMNode): string;var      attr:IHTMLAttributeCollection;      Dispatch:IDispatch;      a:IHTMLDomAttribute;      temp:string;      i:integer;      varAttr:OLEVariant;begin      attr:=Anode.attributes as IHTMLAttributeCollection;      if attr<> nil then      begin      Memo2.lines.add('Attributes '+anode.nodename+'===========');      for i := 0 to attr.length -1  do      begin        varAttr:=i;        DisPatch:=Attr.Item(varAttr);        if assigned(Dispatch) then        begin        a:=Dispatch as IHTMLDOMAttribute;        if assigned(a) then        begin        if (a.specified)then        begin        temp:= temp +' '+a.nodeName+'='+'''' +varToStr(a.nodevalue)+'''';        ListBox1.Items.Add(a.nodeName+'='+'''' +varToStr(a.nodevalue)+'''')        end        else if a.nodename='type' then         Memo2.lines.Add(a.nodeName+'='+'''' +varToStr(a.nodevalue)+'''');        end        end;        end;        a:=nil;      end;      showmessage('att list'+Temp);      dispatch:=nil;      attr:=nil;      result:=temp;end;The HTML is a simple test page as:<html><head><title dir="ltr">Daves Test Page</title></head><body ><h1>Daves Test Page</h1><p>This is a test page for parsing the htm content</p><form name="dataentry" action="aspfred.asp" method="get"><input type="text"  value="fred"  size="12"></form></body>
相簿設定
標籤設定
相簿狀態