1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- $(document).ready(function(){
- var Webdir="/system/";
- var msg_error="<img src=\""+Webdir+"images/msg_error.gif\" align=\"absmiddle\" /> ";
- var msg_load="<img src=\""+Webdir+"images/msg_load.gif\" align=\"absmiddle\" /> "
- function loadbmpcode(){document.getElementById("logincodebmp").src = Webdir+"bmpcode.php?t1=16&temp=" + (new Date().getTime().toString(36));}
- $("#loginuser").focus();
- $("#logincode").focus(function(){
- if($("#showlogincode").html()==""){
- $("#showlogincode").html("<img id=\"logincodebmp\" align=\"absmiddle\" style=\"cursor:pointer\" onClick=\"$('#logincode').val('');$('#logincode').focus();this.src+='?'+Math.random();\" />");
- loadbmpcode();
- }
- });
- $("#loginform").submit(function(){
- var loginuser=$("#loginuser").val();
- var loginpwd=$("#loginpwd").val();
- var logincode=$("#logincode").val();
- if (loginuser == "") {
- $("#formmsg").html(msg_error+"请输入用户帐号");
- $("#loginuser").focus();
- return false;
- }
- if (loginpwd == "") {
- $("#formmsg").html(msg_error+"请输入用户密码");
- $("#loginpwd").focus();
- return false;
- }
- if (logincode == "") {
- $("#formmsg").html(msg_error+"请输入正确的验证码");
- $("#logincode").focus();
- return false;
- }
- var url=Webdir+"login.php?act=login";
- var param="loginuser="+encodeURIComponent(loginuser)+"&loginpwd="+escape(loginpwd)+"&logincode="+escape(logincode);
- jqajax(url,param);
- return false;
- });
- function jqajax(url,param){
- $.ajax({
- type: "POST",url: url,data: param,timeout:20000,
- beforeSend: function(){$("#formmsg").html(msg_load+"正在验证登陆信息...");},
- error:function(){$("#formmsg").html(msg_error+"对不起,服务器繁忙,请稍后再试.");},
- success:function(ajaxmsg){
- switch(ajaxmsg){
- case "1":
- $("#formmsg").html(msg_error+"请输入用户帐号");
- $("#loginuser").focus();
- break;
- case "2":
- $("#formmsg").html(msg_error+"请输入用户密码");
- $("#loginpwd").focus();
- break;
- case "3":
- $("#formmsg").html(msg_error+"请输入正确的验证码");
- $("#logincode").val("");
- $("#logincode").focus();
- break;
- case "4":
- $("#formmsg").html(msg_error+"用户帐号不存在");
- loadbmpcode();
- $("#loginuser").val("");
- $("#loginuser").focus();
- break;
- case "5":
- $("#formmsg").html(msg_error+"用户密码错误");
- loadbmpcode();
- $("#loginpwd").val("");
- $("#loginpwd").focus();
- break;
- case "6":
- $("#formmsg").html(msg_error+"该帐号已被停用!");
- loadbmpcode();
- $("#logincode").focus();
- break;
- case "7":
- location.replace("index.php");
- break;
- default:
- $("#formmsg").html(ajaxmsg);
- }
- }
- });
- }
- });
|