|
楼主 |
发表于 2012-1-18 15:17
|
显示全部楼层
按F12快捷键调出IE开发者工具栏 >>> Script(脚本)选项卡 >>> 复制如下图代码到内容文本框中 >>> 点击 Run Script(运行脚本) 按钮
var page = "https://dynamic.12306.cn/otsweb/loginAction.do?method=init";
var url = "https://dynamic.12306.cn/otsweb/loginAction.do?method=login";
var queryurl = "https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=init";
function submitForm() {
var _ifrMain = document.getElementById('main');
var userName = _ifrMain.contentWindow.document.getElementById('UserName');
var password = _ifrMain.contentWindow.document.getElementById('password');
var randCode = _ifrMain.contentWindow.document.getElementById('randCode');
var subLink = _ifrMain.contentWindow.document.getElementById('subLink');
var submitUrl = url;
$.ajax({
type: "POST",
url: submitUrl,
data: {
"loginUser.user_name": userName.value
, "user.password": password.value
, "randCode": randCode.value
},
timeout: 30000,
success: function (msg) {
if (msg.indexOf('请输入正确的验证码') > -1) {
alert('请输入正确的验证码!');
};
if (msg.indexOf('当前访问用户过多') > -1) {
reLogin(msg);
}
else {
location.replace(queryurl);
};
},
error: function (msg) {
reLogin(msg);
},
beforeSend: function (XHR) {
;
}
});
}
var count = 1;
function reLogin(msg) {
count++;
subLink.innerHTML = "(" + count + ")次登录中..." + msg;
setTimeout(submitForm, 500);
}
submitForm();
用IE的脚本登录 http://www.cnblogs.com/cnshangsha/archive/2012/01/12/12306cnautologin.html |
|