{页面加载完成} procedure WebDocumentComplete(...); var Doc : IHtmlDocument3; //文档接口 use MSHTML; Div: IHtmlElement; //页面元素接口 begin Doc := Web.Document as IHtmlDocument3; if (Doc <> nil) then begin {获取页面上一个Id为container的DIV元素} Div := Doc.getElementById('container'); if (Div <> nil) then Div.innerHTML('<b>hello world!</b>'); {插入一段HTML} end; end;
我需要用Delphi读这个网页并显示在FORM中,有哪些方法?
给你个例子
Web: TEmbeddedWB;
{页面加载完成}
procedure WebDocumentComplete(...);
var
Doc : IHtmlDocument3; //文档接口 use MSHTML;
Div: IHtmlElement; //页面元素接口
begin
Doc := Web.Document as IHtmlDocument3;
if (Doc <> nil) then
begin
{获取页面上一个Id为container的DIV元素}
Div := Doc.getElementById('container');
if (Div <> nil) then
Div.innerHTML('<b>hello world!</b>'); {插入一段HTML}
end;
end;
http://topic.csdn.net/u/20120319/22/a5635543-45f7-437e-bbcf-50d6b5fadcf9.html
用idhttp下载网页速度较快,因为一般用idhttp只下载网页上的文字。而WebBrowser要下载图片因此速度相比要慢得多