读书人

网页中图片按钮怎么提交

发布时间: 2012-02-13 17:20:26 作者: rapoo

网页中图片按钮如何提交!
小弟不会,谁帮帮我啊!或者哪里有资料找啊!

[解决办法]
找到图片按钮的提交地址:
procedure TForm1.PostWeb;
const BaseURL = 'http://www.1798.cn '; //图片地址
//http://www.1798.cn/assistant/Login_Check.asp
var
IdHTTP: TIdHTTP;
Params: TStrings;
HTML: String;
begin
idHTTP:= TidHTTp.create(self);
Params := TStringList.Create;
IdHTTP.AllowCookies := True;
IdHTTP.HTTPOptions:=[hoForceEncodeParams];
IdHTTP.ProtocolVersion := pv1_1;
IDHTTP.Request.Accept:= '*/* ';
IdHTTP.Request.Referer:= 'http://www.1798.cn/assistant/login.asp?pageid=chengxin ';
IdHTTP.Request.AcceptLanguage := 'zh-cn ';
IdHTTP.Request.ContentType := 'application/x-www-form-urlencoded ';
IdHTTP.Request.AcceptEncoding := 'gzip, deflate ';
IdHTTP.Request.UserAgent := 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; Alexa Toolbar; 56flvplayer 1.0) ';
IdHTTP.Request.Host := 'http://www.1798.cn ';
IdHTTP.Request.ContentLength := 8; // length( 'yong ');
IdHTTP.Request.Connection := 'Keep-Alive ';
IdHTTP.Request.CacheControl := 'no-cache ';
Params.Add( 'UsernameGet= '+ ' ' '+editname.text+ ' ' ');
Params.Add( 'PasswordGet= '+ ' ' '+editpd.text+ ' ' ');

try
HTML:=IdHttp.Post(BaseURL+ '/assistant/login.asp?pageid=chengxin ',Params);
except
showmessage( 'error ');
exit;
end;

Edit1.Text := IdHttp.ResponseText;
IdHTTP.Disconnect;
FreeAndNil(IdHTTP);
FreeAndNil(Params);
end;
[解决办法]
procedure TForm1.Button2Click(Sender: TObject);
var
E,I:IHTMLElement;
ID: string;
begin
ID := '你能知道的ID ';
// <img id= "ID " src= "\Images\thefile.gif " align= "absbottom ">
//就是这里的ID
//I:=
I := (WebBrowser1.Document as IHTMLDocument2).images.item(ID,0) as IHTMLElement;
//两个都试一下
E := (WebBrowser1.Document as IHTMLDocument2).all.item(ID,0) as IHTMLElement;
if Assigned(E) then
E.onclick;
if Assigned(I) then
I.onclick;
end;

procedure TForm1.Button3Click(Sender: TObject);
var
i: integer;
T: OleVariant;
begin
T := WebBrowser1.Document;
for i := 0 to T.all.Length -1 do
begin
if T.all.item(i).tagName = 'INPUT ' then
begin
if T.all.item(i).type = 'submit ' then
begin
T.all.item(i).click;
Exit;
end;
end;
end;
end;

读书人网 >.NET

热点推荐