xmlhttp vb如何post这个登陆页面
本帖最后由 in2008 于 2013-01-22 14:51:22 编辑 以下部分js
<script type="text/javascript">
function init(){
$("j_username").focus();
}
function enter_down(evt,ch){
if(evt.keyCode == 13){
if(ch=='uname'){
$('j_password').focus();
}
// //if(ch=='upass' && document.logonForm.j_verifycode=='undefined')
else if(ch=='upass' && document.logonForm.j_verifycode=='[object]'){
$('j_verifycode').focus();
}
else if($('isOk').value!=0){
$('logonForm').submit();
}
else{
$('j_username').select();
$('j_username').focus();
}
}else if(ch=='login'){
if($('isOk').value!=0){
$('info').innerHTML=""
$('logonForm').submit();
}
}
}
function checkUserName(){
var userName = $F('j_username');
if(userName==""){
//$('info').innerHTML="用户名不能为空!";
return;
}
var url = '/WEW/checkUser.do';
var pars = 'act=checkUserLogin&userName=' + userName+"&id="+Math.random();
var myAjax = new Ajax.Request(
url,
{
method: 'get',
parameters: pars,
onComplete: showResponse
});
}
function showResponse(originalRequest){
if(originalRequest.responseText.length<=5){
$('isOk').value=1;
$('info').innerHTML="";
}else{
$('isOk').value=0;
$('info').innerHTML=originalRequest.responseText;
}
}
function updatePass(){
$(info).innerHTML=""
var url = '/WEW/checkUser.do';
var pars = 'act=loadUpdatePassword&id='+Math.random();
var myAjax = new Ajax.Request(
url,
{
method: 'get',
parameters: pars,
onComplete: showUpdatePass
});
}
form如下:
<form name="logonForm" id="logonForm" method="post" action='/WEW/security_check'>
<td height="32" align="right">
用户帐号
<td align="left">
<input name="j_username" type="text" id="j_username"
class="input_border" size="16"
onkeydown="enter_down(event,'uname');" onBlur="checkUserName();">
<input type="hidden" id="isOk" value="0" name="isOk">
</td>
</tr>
<tr>
<td height="32" align="right">
用户密码:</td>
<td align="left">
<input name="j_password" type="password" id="j_password"
class="input_border" size="16"
onkeydown="enter_down(event,'upass');">
</td>
目前只能看到这些信息,利用xmlhttp,,,通过checkUser.do能成功检查用户是否存在信息,但不知道怎么post用户密码登陆,/WEW/security_check ,应该从哪方面着手,如何截获这个登陆过程?
.Open_ "post", "http://123.123.123.123/WEW/logon.do?security_check;id=logonForm&j_username=" + Text1.Text + " &j_password = " + Text2.Text + "", True
.Send_
这样对?
[解决办法]
你这个提交后 Status Code:302 Moved Temporarily
302跳转的话,XMLHTTP一般获取不到跳转页面,还是建议你用一下winsock控件吧