Цитата:
Сообщение от NumLock
Код:
uses
MSHTML,
type
TForm1 = class(TForm)
WebBrowser1: TWebBrowser;
Memo1: TMemo;
Memo2: TMemo;
procedure FormCreate(Sender: TObject);
procedure TForm1.FormCreate(Sender: TObject);
var
document: OleVariant;
HTMLDocument: IHTMLDocument3;
HTMLElementCollection: IHTMLElementCollection;
i: Integer;
HTMLElement: IHTMLElement;
HTMLElementCollection2: IHTMLElementCollection;
j: Integer;
begin
Memo1.Lines.LoadFromFile('Project1.htm');
WebBrowser1.Navigate('about:blank');
while WebBrowser1.ReadyState<READYSTATE_INTERACTIVE do
Application.ProcessMessages;
document:=WebBrowser1.Document;
document.clear;
document.open;
document.write(Memo1.Text);
document.close;
HTMLDocument:=WebBrowser1.Document as IHTMLDocument3;
HTMLElementCollection:=HTMLDocument.getElementsByTagName('ul');
for i:=0 to HTMLElementCollection.length-1 do
begin
HTMLElement:=HTMLElementCollection.item(i, 0) as IHTMLElement;
Memo2.Lines.Add('--'+HTMLElement.getAttribute('data-property', 0)+'--');
HTMLElementCollection2:=HTMLElement.children as IHTMLElementCollection;
for j:=0 to HTMLElementCollection2.length-1 do
Memo2.Lines.Add((HTMLElementCollection2.item(j, 0) as IHTMLElement).innerText);
end;
end;
http://data.cod.ru/130989
http://msdn.microsoft.com/en-us/libr...(v=VS.85).aspx
|
Спасибо тебе огоромное! Ты мне очень помог! Очень полезный сайт=))))