jquery检验用户密码输入合法性程序

2016-02-22    编辑:kp12345     点击(
jquery检验用户密码输入合法性程序

function chkSignIn(language)
{
 if( chkUserNameForSignIn( $.trim($("#username")[0].value),language ) ){
  if( chkUserPwd( $.trim($("#userpwd")[0].value),language ) ){
   return true;
  }else{
   $("#userpwd").focus();
  }
 }else{
  $("#username").focus();
 }
 return false;
}

function chkUserNameForSignIn( str,language )
{
 if( $.trim(str) == '' ){
  if(language == "EN")
  {
   window.alert( "Please enter your member ID!" );
  }
  else
  {
   window.alert( "请输入您的会员名!" );
  }
  return false;
 }
 return true;
}

function chkUserPwd( str,language )
{
 if( $.trim(str) == '' ){
  if(language == "EN")
  {
   window.alert( "Please enter your password!" );
  }
  else
  {
   window.alert( "请输入您的密码!" );
  }
  return false;
 }
 return true;
}