在一个网页上有两个submit 按钮。一个是搜索的。一个是发帖的如果直接            o   :=WebBrowser1.oleobject.document.all.item('submit',0);
      o.Click;
   
       的话它会执行搜索操作。现在我想实现发帖。该怎么修改代码呢。     两个提交的源代码如下
                <input class="s-btn" type="submit" name="submit" value=" " />//搜索 <input class="btn fl b" style="padding:0 1em;*padding:0;width:70px;height:25px;" type="submit" name="Submit" value=" 提 交 " />//发帖谢谢了

解决方案 »

  1.   

    伤脑筋...我记得你了....每次都是up..up...up.......呼呼.....
      

  2.   

    从你提供的HTML代码来看
    <input class="s-btn" type="submit" name="submit" value=" " />//搜索
    当subimt取值为空时候,搜索
    当Submit  value=" 提 交"时候,为 发帖.那么你可以在
    o  :=WebBrowser1.oleobject.document.all.item('submit',0); 
    前,先把
    Submit=" 提 交"试验一下.
      

  3.   

    找不到相应的属性值.jimy能否帮我酝酿下比较的代码呢........谢谢了....
      

  4.   

    procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
      const pDisp: IDispatch; var URL: OleVariant);
    var
      //HTMLDocument1:IHTMLDocument;
      ElementCollection:IHTMLElementCollection;
      HTMLSelectElement:IHTMLSelectElement;
      HTMLInputElement:IHTMLInputElement;
      HTMLInputTextElement:IHTMLInputTextElement;
      Dispatch: IDispatch;
      k:integer;
    begin
      memo1.Lines.Add(WebBrowser1.LocationURL);
      //if WebBrowser1.LocationURL <>'http://reg.qq.com' then exit;
     /// HTMLDocument1 := IHTMLDocument2(WebBrowser1.Document);
      ElementCollection := IHTMLDocument2(WebBrowser1.Document).all;
      if ElementCollection=nil then exit;
      for k := 0 to ElementCollection.length - 1 do begin
        Dispatch := ElementCollection.item(k, 0);
        if Succeeded(Dispatch.QueryInterface(IHTMLInputElement,HTMLInputElement)) then
        begin      
          if (HTMLInputElement.type_='submit')and(HTMLInputElement.name='submit') then
           begin
             HTMLInputElement.value := ' 提 交';       end;
        end
      end;
    end;
      

  5.   

    用户表单名来获取表单,然后直接调用表单的Submit方法提交则可
      代码如下: procedure SubmitForm;
    var
      doc: IHTMLDocument2;
      ElementCollection: IHTMLElementCollection;
      HTMLFormElement: IHTMLFormElement;
      i: integer;
      sFormName: string;
    begin
      sFormName := 'FORM';//表单名, 取网页里具体要提交的表单的名称
      doc := (WebBrowser.Document as IHTMLDocument2);
      ElementCollection := doc.Get_forms;  for i := 0 to ElementCollection.length - 1 do
      begin
        HTMLFormElement := ElementCollection.item(i, varempty) as IHTMLFormElement;
        if SameText(sFormName, HTMLFormElement.name) then
        begin
          HTMLFormElement.submit;
          break;
        end;
      end;
    end;
      

  6.   

    直接给你个链接算了 应该很简单的,自己看看吧http://hi.baidu.com/szba/blog/item/9a0e5c1eed0431fc1bd57697.html