Discussion:
Call Javascript function from Delphi?
(too old to reply)
Robert Oschler
2003-08-05 02:46:30 UTC
Permalink
Is there a way to call a Javascript function that exists inside the current
HTML document residing in a TWebBrowser instance? Please give an example of
finding the script function and calling it or a URL pointing to one.


thx

--

Robert Oschler
"Let the web hear you, add your voice to your web site in minutes!"
-- http://audiodirect.spiderchase.com/
(For a limited time, free voiceover with every sign-up, use this link
instead)
-- http://audio.spiderchase.com/
(A song - are you blue?)
-- http://bluedreams.spiderchase.com/
Pascal Chapuis
2003-08-05 06:16:11 UTC
Permalink
hi,

Using IHtmlWindow2:ExecScript method :

Procedure TMainFormWB.DoIt(Param1: String;Param2: Boolean);
var
HtmlWindow: IHtmlWindow2;
begin
try
HtmlWindow:=(EmbeddedWBLocal.DefaultInterface.document as
IHTMLDocument2).parentWindow;
if Assigned(Htmlwindow) then
begin

HtmlWindow.ExecScript('JavaScriptDoIt("'+HTMLEncode(Param1)+'",'+InttoStr(in
teger(Param2))+')','JavaScript')
end;
Except
HtmlWindow:=Nil;
end;
end;


Pascal
Post by Robert Oschler
Is there a way to call a Javascript function that exists inside the current
HTML document residing in a TWebBrowser instance? Please give an example of
finding the script function and calling it or a URL pointing to one.
thx
--
Robert Oschler
"Let the web hear you, add your voice to your web site in minutes!"
-- http://audiodirect.spiderchase.com/
(For a limited time, free voiceover with every sign-up, use this link
instead)
-- http://audio.spiderchase.com/
(A song - are you blue?)
-- http://bluedreams.spiderchase.com/
Loading...