我想做一个能根据用户在网页上输入的用户和密码,在还没有发出登陆命令时初步判断密码是否正确的小程序。
最大的问题:怎么得到网页上的输入框的句柄?

解决方案 »

  1.   

    function FillForm(WebBrowser: TWebBrowser; FieldName: string; Value: string): Boolean;  
    var  
      i, j: Integer;  
      FormItem: Variant;  
    begin  
      Result := False;  
      //no form on document  
      if WebBrowser.OleObject.Document.all.tags('FORM').Length = 0 then  
      begin  
        Exit;  
      end;  
      //count forms on document  
      for I := 0 to WebBrowser.OleObject.Document.forms.Length - 1 do  
      begin  
        FormItem := WebBrowser.OleObject.Document.forms.Item(I);  
        for j := 0 to FormItem.Length - 1 do  
        begin  
          try  
            //when the fieldname is found, try to fill out  
            if FormItem.Item(j).Name = FieldName then  
            begin  
              FormItem.Item(j).Value  // 這個是你要的
              Result := True;  
            end;  
          except  
            Exit;  
          end;  
        end;  
      end;  
    end;
      

  2.   

    aiirii(ari-爱的眼睛) 大侠,多谢分不够我另开!!!
      

  3.   

    >>分不够我另开!!!
    不用另開貼了, 可以在原貼加分的, 再開貼就不用了
      

  4.   

    你加入一个TWebBrowser,写出给出的函数,看看