答案: WebBrowser1.OleObject.Document.ParentWindow.变量名;
譬如有这样一个页面(lancernig 举的例子), 如何提取其中的 pvs 呢:
假定是把页面保存在 'c:\temp\test.htm', 测试代码如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleCtrls, SHDocVw;
type
TForm1 = class(TForm)
WebBrowser1: TWebBrowser;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
WebBrowser1.Navigate('c:\temp\test.htm');
end;
procedure TForm1.Button1Click(Sender: TObject);
var
s: string;
begin
{提取 smoneys}
s := WebBrowser1.OleObject.Document.ParentWindow.smoneys;
ShowMessage(s);
{提取 pvs}
s := WebBrowser1.OleObject.Document.ParentWindow.pvs;
ShowMessage(s);
end;
end.