Autor Beitrag
smt
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 45



BeitragVerfasst: Mi 20.01.10 16:03 
Hallo,

ich such jetzt schon mehrere Tage, aber irgendwie find ich die Lösung nicht. ;-)

Ich rufe mit dem TWebbrowser bzw. TEmbeddedWeb eine Webseite auf. Und ich möchte nun an verschiede Attribute der Elemente kommen. Beispielsweise an das Attribut "Value" bei einem Button.

Dazu kann ich ja mit IHTMLElement.getattributes('value') dran kommen. Das funktioniert auch soweit. Aber: Wie komme ich denn an ALLE Attribute eines Elements? Der Sourcecode hier unten bringt mir auch Attribute, aber z.B. "Value" ist nie dabei :-(


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure getallattributes(element: IHTMLElement; var liste : TStringList);
VAR domnode : IHTMLDomNode;
    col     : IHTMLAttributeCollection;
    att     : IHTMLDOMAttribute2;
    i       : Integer;
begin
   domnode:=element as IHTMLDomNode;
   col:=domnode.attributes as IHTMLAttributeCollection;

   for i := 0 to col.length - 1 do begin
      att:=col.item(i) as IHTMLDomAttribute2;
      if (att.value <> ''and (att.value <> 'null'then liste.Add(att.name + '=' + att.value);
   end;
end;


Hat irgendjemand eine Ahnung?
Danke !!!

Viele Grüße

- Sascha -
smt Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 45



BeitragVerfasst: Do 21.01.10 11:48 
Hat echt keiner ne Idee zu IHTMLElement?

VG Sascha
smt Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 45



BeitragVerfasst: Do 21.01.10 12:24 
ups.. vergesst was ich gefragt hatte. Der Code funktioniert. Ich hatte einen Fehler im Auslesen der TStringlist... :-(
peinlich peinlich...

VG Sascha