﻿String.prototype.trim=function()
{
    return this.replace(/(\s*$)|(^\s*)/g, '');
}
function CheckLogin()
{
    var user = document.getElementById("tbUsername");
    var password = document.getElementById("tbUserPwd");
    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("divNoMsg").style.display = "none";
    if ((navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0))
    {
        document.getElementById("divMsg").innerText = msg;
    }
    else
    {
        document.getElementById("divMsg").textContent = msg;
    }
}
