菜鸟提问,关于网页登录。
在网页上输入用户名、密码和验证码后点登录可登录设备。请教各位大神:下面是网页的html和js代码,请问我该如何通过HttpReq.Open "POST",url & "/xml?method=.................."这样的格式来实现登录功能(我是菜鸟,请具体点)。谢谢啦!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<script language="javascript" src="md5.js"></script>
<script language="JavaScript">
var RandomString="7938";
var ShowCode=1;
if(self!=top)
{
top.location=self.location;
}
var Lang = "zhcn";
var str1;
var str2;
var trcode;
var subed=false;
var oldpass;
function init()
{
document.getElementById("img_rdm").setAttribute("src","rdm.bmp?ver="+RandomString);
document.getElementById("toplogo").setAttribute("src","topLogo.gif?ver="+RandomString);
trcode=document.getElementById("tr_code");
if(ShowCode==0)
tr_code.style.display="none";
document.getElementById('name').focus();
if(Lang=="en")
{
document.getElementById("i3").src="Login_en_03.gif";
document.getElementById("i5").src="Login_en_05.gif";
document.getElementById("i7").src="Login_en_07.gif";
document.getElementById("i9").src="Login_en_09.gif";
document.cookie="language=en; path=/";
document.title="Login";
str1="Code:";
str2="Please input the code!";
}
else
{
document.getElementById("i3").src="Login_03.gif";
document.getElementById("i5").src="Login_05.gif";
document.getElementById("i7").src="Login_07.gif";
document.getElementById("i9").src="Login_09.gif";
document.cookie="language=zhcn; path=/";
document.title="登录";
str1="验证码:";
str2="请输入验证码!";
}
document.getElementById("s").innerHTML=str1;
}
function login()
{
var psw=document.getElementById("psw"),rdm=document.getElementById("rdm");
var ss;
if(ShowCode==1)
{
if(rdm.value=="")
{
alert(str2);
str2.focus();
return;
}
if(subed==false)
{
ss=psw.value+rdm.value;
oldpass=psw.value;
subed=true;
}
else
{
ss=oldpass+rdm.value;
subed=false;
}
}
else
{
if(subed==false)
{
ss=psw.value;
oldpass=psw.value;
subed=true;
}
else
{
ss=oldpass;
subed=false;
}
}
psw.value=hex_md5(ss);
document.getElementById('formLogin').submit();
}
</script>
<style type="text/css">
.styleHere {
border-left: #636563 1px solid;
border-right: #636563 1px solid;
border-bottom: #636563 1px solid;
background-color: #EFEFEF;
}
</style>
</head>
<body onLoad="init();" onkeydown="if(event.keyCode==13) login();">
<div align="center">
<table width="950" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="60" valign="middle"><img id="toplogo" src="topLogo.gif" width="950" height="60" border="0" usemap="#Map"></td>
</tr>
<form name="formChinese" id="formChinese" method="post" action=/cgi-bin/Form_ChangeLanguage>
<input type="hidden" name="Sel_Language" value="1">
</form>
<form name="formEnglish" id="formEnglish" method="post" action=/cgi-bin/Form_ChangeLanguage>
<input type="hidden" name="Sel_Language" value="0">
</form>
<tr>
<td align="center" valign="middle" class="styleHere">
<form name="formLogin" id="formLogin" method="post" target="_top" action=/cgi-bin/userLogin>
<table>
<tr>
<td colspan="2"><IMG SRC="Login_03.gif" id="i3"></td>
</tr>
<tr>
<td width="81"><IMG SRC="Login_05.gif" id="i5"></td>
<td width="216" valign="bottom"><input class="login" name="name" type="text" id="name" style="width:150px"></td>
</tr>
<tr>
<td><IMG SRC="Login_07.gif" id="i7"></td>
<td valign="bottom"><input class="login" name="psw" type="password" id="psw" style="width:150px"></td>
</tr>
<tr id="tr_code">
<td height="40"></td>
<td valign="bottom"><input class="login" name="rdm" type="text" id="rdm" style="width:60px"> <font style="color:#333333;" size="2" id="s"></font><img id="img_rdm" src="rdm.bmp" border="0"></td>
</tr>
<tr>
<td colspan="2"><img src="Login_09.gif" border="0" usemap="#Map2" id="i9">
<map name="Map2">
<area shape="rect" coords="79,14,121,33" href="javascript:login();">
<area shape="rect" coords="125,15,167,32" href="javascript:document.getElementById('formLogin').reset()">
</map></td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td colspan="2" class="cpyRight"></td>
</tr>
</table>
</div>
<map name="Map">
<area shape="rect" coords="889,18,949,38" href="javascript:document.getElementById('formEnglish').submit()">
<area shape="rect" coords="889,0,949,20" href="javascript:document.getElementById('formChinese').submit()">
</map>
</body>
</html>