曾经写的一组WebBrowser与Script交互的接口,可以与Script变量或者函数交互,可以用delphi挂接页面元素的事件,其实也没啥用处。 unit WebBrowserDepthApiUnit; interface const WebBrowserDepthApi_DLL='WebBrowserDepthApi.dll'; type TSampleEvent=procedure of object; //执行页面脚本的方法 function CallScriptFunc(document: IDispatch; ProcName: PChar; const Params: array of const): OleVariant; stdcall; external WebBrowserDepthApi_DLL; //获取页面脚本变量的值 function GetScriptVar(document: IDispatch; VarName: PChar): OleVariant; stdcall; external WebBrowserDepthApi_DLL; //设置页面脚本变量的值 function SetScriptVar(document: IDispatch; VarName: PChar; const VarValue: OleVariant): OleVariant; stdcall; external WebBrowserDepthApi_DLL; //创建一个页面元素事件 function CreateElementEvent(Event: TSampleEvent): IDispatch; stdcall; external WebBrowserDepthApi_DLL; implementation end. 例题在这里下载 http://download.csdn.net/source/1509934