Var p = new prompts (); $ ('# Username'). blur (function (){ Var username = $ ('# username'). val (); // get the form value If (username = ''){ P. p ('# user_prompt', 'p1', 'p2 p3', the length of 'uppercase and lowercase English letters, Chinese characters, numbers, and underscores (_) is 3-12 bytes '); C_user = ''; } Else if (username. length <3 ){ P. p ('# user_prompt', 'p2', 'p1 p3', 'incorrect user name length! '); C_user = ''; } Else if (! Validate. username (username )){ P. p ('# user_prompt', 'p2', 'p1 p3', 'this user name is invalid. '); C_user = ''; } Else { // Determine whether the user name exists. ajax is based on jQuery $. Get ("chk_username.php", {username: $ ('# username'). val () }, Function (data, textStatus ){ If (data. indexOf ('true ')! =-1 ){ P. p ('# user_prompt', 'p3 ', 'p1 p2',' congratulations, you can register with this user name! '); C_user = 'yes '; } Else { P. p ('# user_prompt', 'p2', 'p1 p3', 'this user name has been registered. select another user name. '); C_user = ''; } }) } Chkreg (); // verify each mouse exit. Function chkreg (){ If (c_user = 'yes' & c_pwd1 = 'yes' & c_pwd2 = 'yes' & c_email = 'yes' & c_checkcode = 'Yes '){ Flag = true; } Else {flag = false ;} } |