jquery实现用户信息修改验证输入方法汇总

2020-05-19 07:39:57易采站长站整理

$("#psMsg").html("");
$("#numMsg").html("");
$("#strmsg").hide();
var vcode = $.trim( $("#vcode").val());
if(vcode == null || vcode =="")
{
vcodeFlag = 1;
$("#vcodeMsg").html("<span class='tips'>请输入验证码</span>");
return false;
}
var re= /^[0-9]*$/;
if(!re.test(vcode))
{
vcodeFlag = 1;
$("#vcodeMsg").html("<span class='tips'>请正确输入验证码</span>");
return false;
}else
{
vcodeFlag = 0;
$("#vcodeMsg").html("");
}
}
$(document).ready(function()
{
/*** 修改用户信息验证 begini */
// begin email
$("#email").focus(function() { check_email();});
// 邮箱格式判断
$("#email").blur(function(){check_email();});
//end email

//bengin realname
$("#realname").focus(function() {check_realname();});
// 校验realname是否正确
$("#realname").blur(function() {check_realname();});
//end realname

//bengin cellphone
$("#cellphone").focus(function() { check_cellphone(); });
// 手机号码格式判断
$("#cellphone").blur(function() { check_cellphone(); });
//end cellphone

//bengin homephone
$("#homephone").focus(function(){ check_homephone(); });
$("#homephone").blur(function(){ check_homephone();});
//end homephone

//bengin addr
// 校验address是否正确
$("#address").focus(function(){ check_address(); });
$("#address").blur(function() { check_address();});
//end addr

//bengin zip
$("#zip").focus(function(){ check_zip(); });
$("#zip").blur(function(){ check_zip(); });
//end zip
//获取市级
$("#province").change(function(){
var province=$(this).val();
$.post("_jquery", {"type":"getProvince" , province:province}, function(msg){
$("#city").html(msg);
$("#region").html("");
});
});
//获取县级
$("#city").change(function(){
var city=$(this).val();
$.post("_jquery", {"type":"getCity" , city:city}, function(msg){
$("#region").html(msg);
});
});
/*** 修改用户信息验证 end ***********/

/***------密码修改验证 begin *************/
//begin oldpassword
$("#oldPassword").focus(function(){ check_oldPassword();});
$("#oldPassword").blur(function(){ check_oldPassword();});
//end oldpassword

//begin newpassword
$("#newPassword").focus(function(){ check_newPassword();});
//newpassword
$("#newPassword").blur(function(){ check_newPassword();});

// repeatpassword
$("#repeatPassword").focus(function(){ check_repeatPassword();});
$("#repeatPassword").blur(function(){ check_repeatPassword();});
/***------密码修改验证 end *************/

/**** ---------卡查询表单提交验证 begin ***********/
var cardnumFlag = 0;
var passwordFlag = 0;
var vcodeFlag = 0;