Javascript 用Delphi程序编写Java脚本
如何将googiespell脚本与带有WebBrowser的Delphi程序结合使用。脚本用于拼写检查。我的代码是用于在Webbrowser中使用java脚本的 这是执行脚本的代码Javascript 用Delphi程序编写Java脚本,javascript,delphi,delphi-7,Javascript,Delphi,Delphi 7,如何将googiespell脚本与带有WebBrowser的Delphi程序结合使用。脚本用于拼写检查。我的代码是用于在Webbrowser中使用java脚本的 这是执行脚本的代码 uses MSHTML_TLB, SHDocVw, ShellAPI; function ExecuteScript(doc: IHTMLDocument2; script: string; language: string): Boolean; var win: IHTMLWindow2; Olela
uses
MSHTML_TLB, SHDocVw, ShellAPI;
function ExecuteScript(doc: IHTMLDocument2; script: string; language: string): Boolean;
var
win: IHTMLWindow2;
Olelanguage: Olevariant;
begin
if doc <> nil then
begin
try
win := doc.parentWindow;
if win <> nil then
begin
try
Olelanguage := language;
win.ExecScript(script, Olelanguage);
finally
win := nil;
end;
end;
finally
doc := nil;
end;
end;
end;
Sample usage:
IDoc: IHTMLDocument2;
Webbrowser1.Document.QueryInterface(IHTMLDocument2, iDoc);
ExecuteScript(iDoc, 'document.login.submit()', 'JavaScript');
使用
MSHTML_TLB、SHDocVw、ShellAPI;
函数ExecuteScript(文档:IHTMLDocument2;脚本:字符串;语言:字符串):布尔;
变量
win:IHTMLWindow2;
Olelanguage:Olevariant;
开始
如果没有,那么
开始
尝试
win:=doc.parentWindow;
如果赢了,那就输了
开始
尝试
语言:=语言;
ExecScript(脚本,Olelanguage);
最后
赢:=零;
结束;
结束;
最后
doc:=零;
结束;
结束;
结束;
示例用法:
IDoc:IHTMLDocument2;
Webbrowser1.Document.QueryInterface(IHTMLDocument2,iDoc);
ExecuteScript(iDoc,'document.login.submit()','JavaScript');
所以我需要使用googiespell脚本进行拼写检查和webbrowser。请帮帮我
您可以从网站下载googiespell脚本ok“ExecuteScript”将仅适用于特定的html文件。我能看看这个HTML文件吗?你应该有它,这个文件应该有拼写检查连接,可能有一些输入表单可用。此文件对该任务至关重要。