表单的提交方式由网页页面中的HTML代码定义,你不能控制提交方式,而激活提交动作,用相应的接口即可完成!以CSDN自动登录为例,有两种写法:1: Uses MSHTML//IHTMLDocument2,IHTMLInputElement,IHTMLFormElement等在其中定义,必须加上该单元!var Doc:IHTMLDocument2; Input:IHTMLInputElement; Form:IHTMLFormElement; begin Doc:=Webbrowser1.Document as IHTMLDocument2; Input:= Doc.all.item('name',0) as IHTMLInputElement; //或者Input:= IHTMLDocument2(Webbrowser1.Document).all.item('name',0) as IHTMLInputElement; Input.value:='Test'; Input:= Doc.all.item('pass',0) as IHTMLInputElement; //或者Input:= IHTMLDocument2(Webbrowser1.Document).all.item('name',0) as IHTMLInputElement; Input.value:='123456'; Form:= Doc.all.item('alogon',0) as IHTMLFormElement; Form.submit; end;2: With WebBrowser1.OleObject.document do begin all.item('name').value:='Test'; all.item('pass').value:='123456; forms.item('alogon').submit; end;再加上错误检测就好了!
◆◆◆ CSDN查询助手,查询方便快捷 ◆◆◆ 下载地址:
http://CoolSlob.ifood1.com/Download/CSDNFinder.exe
http://CoolSlob.8u8.com/Download/Tools/CSDNFinder.Slob[更名为.exe即可]
NMHTTP1。POST(‘url’,‘TET。TXT’);
在文件里写你需要POST的东西;如:
PASSWORD=ASDFASF&MESSAGE=ASDF
Uses MSHTML//IHTMLDocument2,IHTMLInputElement,IHTMLFormElement等在其中定义,必须加上该单元!var
Doc:IHTMLDocument2;
Input:IHTMLInputElement;
Form:IHTMLFormElement;
begin
Doc:=Webbrowser1.Document as IHTMLDocument2;
Input:= Doc.all.item('name',0) as IHTMLInputElement;
//或者Input:= IHTMLDocument2(Webbrowser1.Document).all.item('name',0) as IHTMLInputElement;
Input.value:='Test';
Input:= Doc.all.item('pass',0) as IHTMLInputElement;
//或者Input:= IHTMLDocument2(Webbrowser1.Document).all.item('name',0) as IHTMLInputElement;
Input.value:='123456';
Form:= Doc.all.item('alogon',0) as IHTMLFormElement;
Form.submit;
end;2:
With WebBrowser1.OleObject.document do
begin
all.item('name').value:='Test';
all.item('pass').value:='123456;
forms.item('alogon').submit;
end;再加上错误检测就好了!