有一个网页有两个文本框
一个输入,一个输出
现在需要提交数据给输入框1
等服务器处理完后,再把结果输出到文本框2
提交部分已实现
但是部分还望高手指点
请尽可能用TWebBrowser实现!1

解决方案 »

  1.   

    让服务器返回一个查询字符串?output=XXX
    //html
    ...
    <input type="text" name="output" value="">
    ...
    //delphi
    var
      Doc: IHTMLDocument2;
      ElementCollection: IHTMLElementCollection;
      HtmlInputElement: IHTMLInputElement;
    begin
      Doc := WBMain.Document as IHTMLDocument2; //WBMain: TWebBrowser
      HtmlInputElement := Doc.all.item('output', '') as IHTMLInputElement;
      HtmlInputElement.value = Doc.queryCommandValue('output');
    ...
    end;