﻿// JScript 文件

function lo()
{
   var obj = document.getElementById("cb1"); 
    var username=document.getElementById("textname").value.replace(/(^\s+)|(\s+$)/g,""); 
     var userpass=document.getElementById("textpass").value.replace(/(^\s+)|(\s+$)/g,"");
     var cbx=0;
    if(obj.checked == true)
    {
        cbx=1;
    }
    if(username.length>90 ||userpass.length>20)
    {
        alert("用户名或密码错误!");
        window.location="index.aspx";
    }
    else if(username=="")
    {
        alert("用户名不能为空!");
        window.location="index.aspx";
    }
    else if(userpass=="")
    {
        alert("密码不能为空!");
        window.location="index.aspx";
    }
    else
    {
        $.ajax(
        {
         type:"GET",
         dataType:"html",   
         url:"indexlogins.ashx",
         data:"tid=1&t1="+encodeURIComponent(username)+"&t2="+userpass+"&t3="+cbx+"&abc="+ Math.random(),
         cache:false,
         success:function(result)
         {
            if(result==1)
            {
//            window.location='Default.aspx';
                window.location='admin/adminindex.aspx';
            }
            else
            {
                alert("用户名或密码错误!");
                window.location="index.aspx";
            }            
         }
         })
    }
}
