﻿/*
* 统一通信管理平台登录
*/

/*初始加载*/
$(document).ready(function () {

    var serviceNo = $("#txtServiceNo");
    var UserAccount = $("#txtUserAccount");
    var UserPassword = $("#txtUserPassword");
    var CheckNo = $("#txtCheckNo");
    var msg = $("#p_msg");

    serviceNo.focus();

    /*失去焦点--非法字符验证*/
//    serviceNo.blur(function () {        
//        var rem = JudgeUserAccountNoSpace(serviceNo.val(), serviceNo.attr("MaxLength"));
//        if (rem != '') {
//            alert(rem);
//            serviceNo.focus();
//        }
//    });
//    UserAccount.blur(function () {
//        var rem = JudgeUserAccountNoSpace(UserAccount.val(), UserAccount.attr("MaxLength"));
//        if (rem != '') {
//            alert(rem);
//            UserAccount.focus();
//        }
//    });
//    UserPassword.blur(function () {
//        var rem = JudgeUserAccountNoSpace(UserPassword.val(), UserPassword.attr("MaxLength"));
//        if (rem != '') {
//            alert(rem);
//            UserPassword.focus();
//        }
//    });
    CheckNo.blur(function () {
        var rem = JudgeUserAccountNoSpace(CheckNo.val(), CheckNo.attr("MaxLength"));
        if (rem != '') {
            alert(rem);
            CheckNo.focus();
        }
    });

    /*登录按钮单击事件--表单验证*/
    $("#btnLogin").click(function () {
        if (serviceNo.val() == "") {
            msg.text("代理商编号不能为空!");
            serviceNo.focus();
            return false;
        }
        if (UserAccount.val() == "") {
            msg.text("用户名不能为空");
            UserAccount.focus();
            return false;
        }
        if (UserPassword.val() == "") {
            msg.text("密码不能为空");
            UserPassword.focus();
            return false;
        }
        if (CheckNo.val() == "") {
            msg.text("请输入验证码");
            CheckNo.focus();
            return false;
        }
    });
});


