TWebBrowser取得一个页面的所有链接

//--------列出一个页面的所有的链接---------
procedure TForm1.Button6Click(Sender: TObject);
var
Doc: IHTMLDocument2;
Len: Integer;
item: OleVariant;
all: IHTMLElementCollection;
I: Integer;
begin
Doc := WebBrowser1.Document as IHTMLDocument2;
all := Doc.links;
Len := all.length;
for I := 0 to Len -1 do
begin
item := all.item(I, EmptyParam);
Memo1.Lines.Add(item.href) ;
end;
end;

posted on 2012-02-01 18:00  long6  阅读(338)  评论(0)    收藏  举报

导航