登录以显示中间加密帐户
//手机号码显示时留下前三个后四个中间四个*号码
script//session用户帐户var loginname=$ { session scope.loginname }; $(function () ) if(loginname!==' ' ) {varresult=/^{d{3}}d{4}}$/; //中间4位加密为loginname=loginname.tostring (.replace (result,' $1****$2) ) ) ) ) ) ) //页面显示加密号码$(.zsl-logined-name ) ).text ) loginname )。 (); /script //手机号码显示时留下前三个后一个中间的7个*号码
varresult=/^(d{3} ) (d{7} ) (d{1} ) $/; loginname=loginname.tostring (.replace (result,' $1*******$2' ); console.log (loginname '=178 * * * * *0' ); 也可以用字符串substring剪切
var phone='13035421234 '; varresult=cell phone.substring (0,3 ) ' ***'cellphone.substring ) 7,11 ); 控制台. log (result (=130 * * * * 1234 );