标签:
ExecuteJavaScript(WebBrowser:TWebBrowser; Code: string):Variant;
var //发送脚本
Document:IHTMLDocument2;
Window:IHTMLWindow2;
begin
// execute javascript in webbrowser
Document:=WebBrowser.Document as IHTMLDocument2;
if not Assigned(Document) then Exit;
Window:=Document.parentWindow;
if not Assigned(Window) then Exit;
try
Result:=Window.execScript(Code,‘JavaScript‘);
except
on E:Exception do raise Exception.Create(‘Javascript error ‘+E.Message+‘ in: ‘#13#10+Code);
end;
end;
标签:
原文地址:http://www.cnblogs.com/findumars/p/5796963.html