﻿// JScript 文件
function checkLogin()
{

  var username=document.getElementById("txtUserName").value;
  var password=document.getElementById("txtUserPwd").value;
  if(username=="")
  {
  alert("请输入用户名！");
  return;
  }
   if(password=="")
  {
  alert("请输入密码！");
  return;
  }
  $.ajax({type:'post',url:'/AddInfo/AjaxLogin.aspx',data:{txtName:username,txtPassword:password,type:'1'},cache:false,dataType:"html",success:function(msg){if(msg=='ok'){window.location.href='/admin/Index.aspx';}else if(msg=='wrong'){alert('用户名或密码错误,请再试一次！');}else if(msg=='wram'){alert('您的浏览器Cookie功能可能被禁用，请启动。');}}})
}


function SetLogin()
{
    $('#LoginUserName').hide();
    $('#LoginPwd').hide();
    $('#Searching').show();
    var username=$('#txtUserName').val();
    var pwd=$('#txtUserPwd').val();
    if(username==''||pwd=='')
    {
        alert('请输入用户名或密码');
        $('#Searching').hide();
        $('#LoginUserName').show();
        $('#LoginPwd').show();
        return false;
    }
    else
    {
        $.ajax({type:"POST",async:false,url:'/AddInfo/AjaxLoginIn.aspx',data:{uid:username,pwd:pwd},cache:false,dataType:"html",success:function(data){if(data=='ok'){window.location.href="/admin/index.aspx";}else if(data=='-1'){alert('请输入用户名或密码');$('#Searching').hide();$('#LoginUserName').show();$('#LoginPwd').show();}else if(data=='uid'){alert('用户名不正确');$('#Searching').hide();$('#LoginUserName').show();$('#LoginPwd').show();}else if(data=='pwd'){alert('密码不正确');$('#Searching').hide();$('#LoginUserName').show();$('#LoginPwd').show();}else if(data=='-100'){alert('检测到您的浏览器未开启Cookie功能，请开启后重试！');$('#Searching').hide();$('#LoginUserName').show();$('#LoginPwd').show();}else{alert('服务器繁忙,请稍候再试！');$('#Searching').hide();$('#LoginUserName').show();$('#LoginPwd').show();}}})
    }
}

