I
ivan526
Unregistered / Unconfirmed
GUEST, unregistred user!
代码基本是这样:
procedure TForm1.ButtLoginClick(Sender: TObject);
begin
WebBrowser1.Navigate('http://202.193.64.34/club2');
editUserName.Enabled :=False;
editPasswd.Enabled :=False;
buttLogin.Enabled :=False;
StatusBar1.SimpleText:='正在登录>>>>>';
end;
procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
var
k:integer;
t:OleVariant;
begin
if (WebBrowser1.LocationURL='http://202.193.64.34/club2') then
begin
t := WebBrowser1.Document;
for k := 0 to t.all.length - 1 do
begin
// showmessage(t.all.item(k).tagname);
if (uppercase(t.all.item(k).tagName)='INPUT')and (uppercase(t.all.item(k).Name)='USERNAME') then
t.all.item(k).value:=editUserName.Text;
if (uppercase(t.all.item(k).tagName)='INPUT')and (uppercase(t.all.item(k).Name)='PASSWORD') then
t.all.item(k).value:=editPasswd.Text ;
if (uppercase(t.all.item(k).tagName)='INPUT')and (uppercase(t.all.item(k).Name)='') then
begin
t.all.item(k).click;
break;
end;
end;
end;
if (WebBrowser1.LocationURL='http://202.193.64.34/club2/main.htm') then
begin
StatusBar1.SimpleText:='登录成功';
end;
end;
procedure TForm1.ButtLoginClick(Sender: TObject);
begin
WebBrowser1.Navigate('http://202.193.64.34/club2');
editUserName.Enabled :=False;
editPasswd.Enabled :=False;
buttLogin.Enabled :=False;
StatusBar1.SimpleText:='正在登录>>>>>';
end;
procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
var
k:integer;
t:OleVariant;
begin
if (WebBrowser1.LocationURL='http://202.193.64.34/club2') then
begin
t := WebBrowser1.Document;
for k := 0 to t.all.length - 1 do
begin
// showmessage(t.all.item(k).tagname);
if (uppercase(t.all.item(k).tagName)='INPUT')and (uppercase(t.all.item(k).Name)='USERNAME') then
t.all.item(k).value:=editUserName.Text;
if (uppercase(t.all.item(k).tagName)='INPUT')and (uppercase(t.all.item(k).Name)='PASSWORD') then
t.all.item(k).value:=editPasswd.Text ;
if (uppercase(t.all.item(k).tagName)='INPUT')and (uppercase(t.all.item(k).Name)='') then
begin
t.all.item(k).click;
break;
end;
end;
end;
if (WebBrowser1.LocationURL='http://202.193.64.34/club2/main.htm') then
begin
StatusBar1.SimpleText:='登录成功';
end;
end;