楼上提供的资料我基本掌握,但是我发现这个twebbrowers每次都要把页面全部装载完成之后才能进行填写动作,不知有没有什么更快速的方法?
还有就是我不知道怎么动态创建twebbrowers,看看我的代码:
procedure TForm1.Button3Click(Sender: TObject);
var
tempWEB:TWebBrowser;
D : IHTMLDocument2;
Form : IHTMLFormElement ;
i:integer;
begin
tempweb:=TWebBrowser.Create(Application);
//tempweb.Parent:=self;
tempweb.Navigate('http://www.hnphs.net/zfdx.jsp');
application.MessageBox(pchar(inttostr(tempweb.ReadyState)),'test');
i:=0;
repeat
// application.MessageBox(pchar(inttostr(tempweb.ReadyState)),'test');
// inc(i);
// if i>10 then exit;
until tempweb.ReadyState=READYSTATE_INTERACTIVE;
//这里的ReadyState好象只会为READYSTATE_INTERACTIVE,而不能成为READYSTATE_COMPLETE
d:=tempweb.Document as IHTMLDocument2;
form := d.forms.item(varNull,01) as IHTMLFormElement;
(form.item('p_postcode',0) as IHTMLElement).setAttribute('value','0738',0);//所以一执行到这里就会出异常
(form.item('p_phonenum',0) as IHTMLElement).setAttribute('value',edit4.Text,0);
(form.item('p_password',0) as IHTMLElement).setAttribute('value',edit5.Text,0);
(form.item('mysendinfo',0) as IHTMLElement).setAttribute('value',edit2.Text,0);
(form.item('p_PhoneList',0) as IHTMLElement).setAttribute('value',edit3.Text,0);
form.submit;
tempweb.Destroy;
end;
这个该怎么解决?