﻿String.prototype.trim=function()
{
    return this.replace(/(\s*$)|(^\s*)/g, '');
}
function CheckLogin()
{
    var user = document.getElementById("tbName");
    var password = document.getElementById("tbPassword");
    var code = document.getElementById("tbCode");
    if(user.value.trim() == "")
    {
        user.focus();
        ShowErr("请输入用户名。");
        return false;
    }
    if(password.value.trim() == "")
    {
        password.focus();
        ShowErr("请输入密码。");
        return false;
    }
    if(code.value.trim() == "")
    {
        code.focus();
        ShowErr("请输入验证码。");
        return false;
    }
    return true;
}
function ShowErr(msg)
{
    document.getElementById("divMsg").style.display = "block";
    document.getElementById("divMsg").innerText = msg;
    document.getElementById("divNoMsg").style.display = "none";
}
