引用单元 MSHTML, 结合tWebBrowser 空间
function GetDocument(WebBrowser: TWebBrowser): IHTMLDocument2;
var
doc: IDispatch;
begin
result := nil;
if WebBrowser = nil then
exit;
doc := WebBrowser.Document;
if doc = nil then
exit;
result := doc as IHTMLDocument2;
end;