比如按妞名字为SUBMIT,如何使用DELPHI让他点击呢?谢谢

解决方案 »

  1.   

    var
    o : Olevariant;
    o := WebBrowser1.OleObject.document.all.item('User_Id',0);   //找到登录用户名的输入框
    //o.value := '0096';
    o.value :=id;
    o := WebBrowser1.oleobject.document.all.item('password',0); //找到登录密码的输入框
    //o.value := '0096';
    o.value :=password;
    //WebBrowser1.oleobject.document.Forms.Item('btn_Sure', 0).submit;          //第一个表单提交
    //{
    o := WebBrowser1.oleobject.document.all.item('btn_Sure',0);          //或者用指定表单名称提交
    o.Click;
      

  2.   

    以上老是报错哦
    比如:http://www.ip138.com/sj/
    一个输入框mobile,一个提交按妞submit
      

  3.   

    网页源文件例子
    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>新建网页 1</title>
    <script>
    function aa(){
      alert("你好")
    }
    </script>
    </head><body><form method="POST" action="--WEBBOT-SELF--">
    <p><input type="button" value="按钮" name="B3" onclick="aa()"></p>
    </form></body></html>Delphi源码例子
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, OleCtrls, SHDocVw_TLB, EmbeddedWB;type
      TForm1 = class(TForm)
        EmbeddedWB1: TEmbeddedWB;
        Button1: TButton;
        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
        doc: OleVariant;
        i:integer;
    begin
      doc:=EmbeddedWB1.document;
      for i:=0 To doc.all.length-1 do
      begin
        if (doc.all.item(i).tagName = 'INPUT')and (doc.all.item(i).name ='B3') then
          doc.all.item(i).click;
      end;
    end;procedure TForm1.FormCreate(Sender: TObject);
    begin
      EmbeddedWB1.Navigate('C:\Documents and Settings\Administrator\桌面\index.htm');
    end;end.