unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, StdCtrls, SHDocVw_TLB;
type
TForm1 =
class(TForm)
Button1: TButton;
Edit1: TEdit;
Button2: TButton;
WebBrowser1: TWebBrowser;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Webbrowser1.Navigate(Edit1.TExt);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
vDoc, vFrame, vForm: OleVariant;
iFrame, iForm: Integer;
sElement:
string;
begin
//iFrame, iForm, sElement assumed valid
vDoc := WebBrowser.OleObject.Document;
vFrame := vDoc.frames.item(iFrame);
vDoc := vFrame.contentWindow.Document;
vForm := vDoc.forms.item(iForm);
vForm.elements.item(sElement).value := '
1';
end;
end.