IHTMLElementCollection

IHTMLElementCollection

有没有一种方法可以遍历IHTMLElementCollection?



var
  e : IHTMLLinkElement;
elementCollection:IHTMLElementCollection;
begin
    for e in elementCollection do
      showmessage(e.caption);
end;


我知道有一个名为_newEnum的属性,但是据我所知,它在Delphi中不受支持。

更新:
相应地,链接是IHTMLElement而不是IHTMLLinkElement

最佳答案

for I := 0 to Pred(elementCollection.length) do
begin
  e := elementCollection.item(I, EmptyParam) as IHTMLElement;
  //...
end;

10-05 22:42