$(function () { $("#txt_user").focus();//考生编号输入焦点 $("#txt_user").keydown(function (event) { if (event.which == "13") {//回车键,移动光标到身份证号 $("#txt_password").focus(); } }); $("#txt_password").keydown(function (event) { if (event.which == "13") {//回车键,用.ajax提交表单 $("#txtCheckNo").focus(); } }); $("#txtCheckNo").keydown(function (event) { if (event.which == "13") {//回车键,移动光标到密码框 $("#btnLogin").trigger("click"); } }); $("#btnLogin").click(function () { //“登录”按钮单击事件 //获取用户名称 var struser = encodeURI($("#txt_user").val()); //出生日期 var strcsrq = encodeURI($("#txt_password").val()); //验证码 var strCheckNo = encodeURI($("#txtCheckNo").val()); //开始发送数据 $.ajax ({ //请求登录处理页 url: "Validate_clsc_Login.aspx", //登录处理页 dataType: "text", //传送请求数据 data: { txtuser: struser, txtcsrq: strcsrq, txtCheckNo: strCheckNo }, success: function (strValue) { //登录成功后返回的数据 //根据返回值进行状态显示 if (strValue == "1") { alert('考生编号或身份证号不正确!'); //window.location.href = "Default.aspx"; } if (strValue == "2") { alert('密码错误!'); } if (strValue == "3") { alert('输入正确的验证码'); } if (strValue == "4") { window.location.href = "clsc_ss_default.aspx"; } if (strValue == "5") { alert('未确认复试科目!请前往 http://yzglxt.lucky-special.com/gts/fsgl/Fskmqd.aspx确认复试科目'); } } }) }) }) function changeImg() { $("#imgCheckNo").attr("src", "../Cjgl/ValidateImage.aspx?r=" + getRandom(999)); } function getRandom(n) { return Math.floor(Math.random() * n + 1) }