我水平很菜,但是我想学好DELPHI,还望大家赐教.
unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, OleCtrls, SHDocVw, StdCtrls;type
  TForm1 = class(TForm)
    Button1: TButton;
    WebBrowser1: TWebBrowser;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
  Docs, ovElements: OleVariant;
begin
  Docs := WebBrowser1.OleObject.Document;
  ovElements := Docs.GetElementByID('TextBoxUserName');
  ovElements.Value :='民生之家';
  ovElements := Docs.GetElementByID('TextBoxPassword');
  ovElements.Value :='zhoushuren';
  ovElements := Docs.GetElementByID('email');
  ovElements.Click;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
  WebBrowser1.Navigate('http://reg.hexun.com/login.aspx');
end;end.

解决方案 »

  1.   

    验证通过了
    procedure TForm1.Button7Click(Sender: TObject);
    var
      Docs, ovElements, form: OleVariant;
      wsName: widestring;
    begin
      Docs := WebBrowser1.OleObject.Document;
      form := Docs.GetElementById('form1');  ovElements := Docs.GetElementByID('TextBoxUserName');
      wsName := '民生之家';
      ovElements.Value := wsName ;
      ovElements := Docs.GetElementByID('TextBoxPassword');
      ovElements.Value :='zhoushuren';
      ovElements := Docs.getElementById('submitsign');
      ovElements.value := 1;  form.submit;
    end;