Uses mshtml;//网页相关的接口定义
procedure TForm1.Button7Click(Sender: TObject);
var
doc: IHTMLDocument3;
input: IHTMLElement;
btn: IHTMLElement;
begin
try
Fiscomplete := False;
WebBrowser1.Navigate('http://opac.nlc.cn/F');
while not Fiscomplete do
begin
Application.ProcessMessages;
end;
doc := WebBrowser1.Document as IHTMLDocument3;
input := doc.getElementById('reqterm') as IHTMLElement;
input.innertext := trim(Edit1.Text);
WebBrowser1.oleobject.document.Forms.Item(1, 0).submit;
// btn := doc.getElementsByName('submit') as IHTMLElement;
// if Assigned(btn) then
// begin
// Memo1.Lines.Add('OK');
// end;
except
on e: Exception do
begin
Memo1.Lines.Add(e.Message);
end;
end;
procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
begin
if WebBrowser1.ReadyState = 4 then
begin
Fiscomplete := true;
end;
end;