jquery registration verification

funCheck [0] = function (str) (/ / account number
if (isNotNull (str))
(Return 0;)
else (return 1;)
)
funCheck [1] = function (str) (/ / nickname
if (isNotNull (str)) (
return 0;
)
else (return 1;)
)
funCheck [2] = function (str) (/ / email
if (isEmail (str))
(Return 0;)
else (return 1;)
)
funCheck [3] = function (str) (/ / Tel
if (isTel (str) | | isPhone (str))
(Return 0;)
else (return 1;)
)
//--------
funCheck [4] = function (str) (/ / password
if (isNotNull (str))
(Return 0;)
else (return 1;)

)

funCheck [5] = function (str) (/ / Confirm Password
if (isNotNull (str)) (
if ($("# passwd1 "). val () == $ (" # passwd2 "). val ()) (
return 0;
) Else (
return 2;
)
)
else (return 1;)
)
funCheck [6] = function (str) (/ / password prompt problem
if (str == null | | str == "") (return 1;) else (
if (isSmall (str, 20)) (return 0;)
else (return 2;)
)
)
funCheck [7] = function (str) (/ / password prompt answer
if (str == null | | str == "") (return 1;) else (
if (isSmall (str, 20)) (return 0;)
else (return 2;)
)
)
//------------
funCheck [8] = function (str) (/ / real name

return 0;
)
funCheck [9] = function (str) (/ / Age
if (str == "" | | str == null) (return 0;)
if (str> 0 & & str <100) (return 0;) else (return 1;)
)
funCheck [10] = function (str) (/ / Personal Home
return 0;
)
funCheck [11] = function (str) (/ / qq
return 0;
)
funCheck [12] = function (str) (/ / Introduction
if (isSmall (str, 100))
(Return 0;)
else (return 1;)
)

$ (Document). Ready (function () (
var uid = false;

/ * This part is to realize the time to select a different input, display different prompts * /
$ (". Text_01"). Focus (function () (
/ / Alert ($ (this). Parent (). Next ("div"). Attr ("class"));
$ (This). Parent (). Next ("div"). Html (msgInfo [$(". text_01 "). Index ($ (this) [0])] [0]);
$ (This). Parent (). Next ("div"). RemoveClass ();
$ (This). Parent (). Next ("div"). AddClass ("tips2");
));
$ (". Text_01"). Blur (function () (
/ / Alert ($ (this). Parent (). Next (). Html ());

$ (This). Parent (). Next ("div"). Html ("");
$ (This). Parent (). Next ("div"). RemoveClass ();
/ / Alert ($ (this). Attr ("id"));
if ($ (this). attr ("id") == "usrname") (

if (isNotNull (this.value)) (/ / if the user name is not empty
if (isSmall (this.value, 6)) / / If the user name is less than 6
(
$ (This). Parent (). Next ("div"). RemoveClass ();
$ (This). Parent (). Next ("div"). AddClass ("wrong");
$ (This). Parent (). Next ("div"). Html ("<img src='../img/zhaoshang2/zhao2_06.gif' border='0' />" + msgInfoUID [4]);
/ / $ (This). Parent (). Next ("div"). Html (msgInfoUID [4]);

uid = false;

)
else (
if (isUID (this.value)) (
var flag = 0;
/ / Alert (1);
var murl = ".. / ashx / RegisterCheck.ashx? & name =" + encodeURI ($("# usrname "). val ());
$. Ajax (
(
type: "GET",
url: murl,
data: "",
/ / Async: false, / / synchronous request, the request only after the completion of other operations can be carried out
success: function (result) (

var isUsed = result;
/ / Alert (isUsed);
if (isUsed == "false") (/ / can be registered
/ / Alert ("can register");
$($("# Usrname ")). Parent (). Next (" div "). RemoveClass ();
$($("# Usrname ")). Parent (). Next (" div "). Html (msgInfoUID [3]);
$($("# Usrname ")). Parent (). Next (" div "). AddClass (" right ");
uid = true;
/ / Alert (isUsed);
)
else (/ / user name has been registered
/ / Alert ("user name has been registered");
/ / Alert ($(". text_01 "). Index ($ (this) [0]));
$($("# Usrname ")). Parent (). Next (" div "). RemoveClass ();
$($("# Usrname ")). Parent (). Next (" div "). AddClass (" wrong ");
$($("# Usrname ")). Parent (). Next (" div "). Html (" <img src='../img/zhaoshang2/zhao2_06.gif' border='0' /> "+ msgInfoUID [2]);
/ / Alert ($ (this). Parent (). Next ("div"). Attr ("class"));
/ / Alert ($ (this). Html ());
uid = false;
)
)
));

)
else (
/ / Alert (2);
$($("# Usrname ")). Parent (). Next (" div "). RemoveClass ();
$($("# Usrname ")). Parent (). Next (" div "). Html (msgInfoUID [0]);
$($("# Usrname ")). Parent (). Next (" div "). AddClass (" wrong ");
uid = false;
)
)
)
else (
/ / Alert (3);
$($("# Usrname ")). Parent (). Next (" div "). RemoveClass ();
$($("# Usrname ")). Parent (). Next (" div "). Html (msgInfoUID [1]);
$($("# Usrname ")). Parent (). Next (" div "). AddClass (" wrong ");
uid = false;
)

)
if (funCheck [$(". text_01 "). index ($ (this) [0 ])]($( this) [0]. value) == 0) (
/ / Alert (4);
if ($(". text_01 "). index ($ (this) [0])! = 0 & & $ (". text_01 "). index ($ (this) [0])! = -1) (

/ / Alert (5);
$ (This). Parent (). Next ("div"). RemoveClass ("wrong");
$ (This). Parent (). Next ("div"). RemoveClass ("tips2");
)
)
else (
/ / Alert (2);
/ / / Alert ($(". text_01 "). Index ($ (this) [0]));
$ (This). Parent (). Next ("div"). Html ("<img src='../img/zhaoshang2/zhao2_06.gif' border='0' />" + msgInfo [$(". text_01 "). index ($ (this) [0])] [funCheck [$(". text_01"). index ($ (this) [0 ])]($( this) [0]. value)]) ;
$ (This). Parent (). Next ("div"). AddClass ("wrong");

)
/ / Alert (funCheck [$(". kinput "). Index ($ (this) [0 ])]($( this) [0]. Value));
));

/ * Whether there is authentication * /

$ ("# Submit_butt"). Click (function () (/ / click the error when the authentication data is not all legal, if all legal, then submit, or else return false;
var isCheck = true;
/ / Alert (0);

$ (". Text_01"). Each (function (j) (
if (j <= 7)
$($(". Text_01 "). Get (j)). Blur ();
));
$ (". Wrong"). Each (function (i) (
isCheck = false;
));
/ / If ($("# usrname "). Val () ==" ") (
/ / IsCheck = false
/ /)
if (isCheck == false) (
alert ("Please fill in the requested zone (*) Number of items");
)

return isCheck;
))
/ / $ (Document). Click (function () (
/ / / / $ ("# Wrap"). Show (5000);
/ / / / $ ("# Wrap"). FadeOut (1000);
/ /))
))
</ Script>

</ Form>
</ Body>
</ Html>
<script language="javascript" type="text/javascript" src="../JS/check.js"> </ script> this file is as follows

/ *
Limit the number of bits input characters
str is the user input string, len is to limit the number of bits
----------------------------
* /
function isSmall (str, len) (
if (str.length <len) (
return (true);
) Else (
return (false);
)
)

/ * Check the consistency of the two strings
---------------------------------
* /
function isSame (str1, str2) (
if (str1 == str2) (
return (true);
) Else (
return (false);
)
)

/ *
Determine whether the empty string start
---------------------------------
* /
function isNotNull (str) (
if (str.length ==""){
return (false);
) Else (
return (true);
)
)
/ *
Judgement is not a mobile phone number
---------------------------------
* /
function isPhone (str) (

reg = / ^ [0]? 13 \ d (9) $ / gi;
reg2 = / ^ [0]? 15 \ d (9) $ / gi;
if (! reg.test (str) & &! reg2.test (str)) (
return false;
)
return true;
)
/ *
Determine whether the user name contains characters (user name can not be Chinese, but also with special characters are not allowed)
Note:
Regular expressions. Test () method is used to detect whether a string matches a pattern
---------------------------------
* /
function notChinese (str) (
var reg = / [^ A-Za-z0-9_] / g
if (reg.test (str)) (
return (false);
) Else (
return (true);
)
)

/ *
Determine whether the date
----------------------------------
* /
function isDate (theStr) (
var the1st = theStr.indexOf ('-');
var the2nd = theStr.lastIndexOf ('-');

if (the1st == the2nd) (
return (false);
)
else (
var y = theStr.substring (0, the1st);
var m = theStr.substring (the1st +1, the2nd);
var d = theStr.substring (the2nd +1, theStr.length);
var maxDays = 31;

if (fucCheckNUM (m) == false | | fucCheckNUM (d) == false | | fucCheckNUM (y) == false) (
return (false);)
else if (y.length <4) (return (false);)
else if ((m <1) | | (m> 12)) (return (false);)
else if (m == 4 | | m == 6 | | m == 9 | | m == 11) maxDays = 30;
else if (m == 2) (
if (y% 4> 0) maxDays = 28;
else if (y% 100 == 0 & & y% 400> 0) maxDays = 28;
else maxDays = 29;
)
if ((m <1) | | (m> maxDays)) (return (false);)
else (return (true);)
)
)
/ *
Determine whether the number of
---------------------------------------
* /
function isNum (num) (
var i, j, strTemp;
strTemp = "0123456789";
if (num.length == 0) (
return false;
)
for (i = 0; i <num.length; i + +) (
j = strTemp.indexOf (num.charAt (i));
if (j ==- 1) (/ / specifying the number of characters is not
return false;
)
)

return true; / / note numbers
)

/ *
Determine whether a fixed number of bits

-------------------------
* /
function isAtn (str, n) (
if (str.length! = n) (
return (false);
)
else (
return (true);
)
)

/ *
Determine whether the telephone number for the beginning (completed)
--------------------------
* /
function isTel (telstr)
(
var reg1 = / (\ (\ d (3) \) | \ d (3) -)? \ d (8) / g; / / 8 phone numbers
var reg2 = / (\ (\ d (3) \) | \ d (3) -)? \ d (7) / g; / / 7 phone number
if (telstr !="") (
if (reg1.test (telstr) | | reg2.test (telstr)) (
return (true);
)
else (
return (false);
)
) Else (return (false);)
)

/ *
Determine whether the email 【simple to verify whether the @ and.】 (Completed)
---------------------------
* /
function isEmail (emailstr) (
/*-------------------
if ((emailstr.indexOf ('@', 0) == -1) | | emailstr.indexOf ('.') == -1) (
return false;
)
else (
return true;
)
---------------------*/
var reg = / \ w +([-+.'] \ w +) * @ \ w +([-.] \ w +) * \. \ w +([-.] \ w +) * / i;
if (emailstr !="") (
if (reg.test (emailstr)) (
return (true);
)
else (
return (false);
)
)
else (
return (false);
)
)
/ *
Determine whether the Postal Code
---------------------------
* /
function isPostCode (str) (
var reg = / \ d (6) / g;
if (str !="") (
if (reg.test (str)) (
return (true);
)
else (
return (false);
)
)
else (
return (false);
)
)

/ *
Chinese character input judge
---------------------------
* /
function isChinese (str) (
/ / If the value is empty, do not pass validation
if (str == "")
return false;
var pattern = / ^ ([\ u4E00-\ u9FA5] | [\ uFE30-\ uFFA0 ])*$/ gi;
if (pattern.test (str))
return true;
else
return false;
)
/ * Determine the user name was included in the case alphanumeric and _ * /
function isUID (str) (
var jgpattern = / ^ [A-Za-z0-9_ ]+$/;
var huzhaocard = str;
if (! jgpattern.test (huzhaocard))
(
return false;
)
else
(
return true;
)
)
/ / Check is not at
function isHttp (str)
(
var pattern = / ^ (http: \ / \ /)? [a-zA-Z0-9-] + (\. [a-zA-z0-9-] +) + \ /? $ / gi;
if (pattern.test (str))
(

return true;
)
else
(
return false;
)
)
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of jquery registration verification

  • Hibernate configuration parameters hibernate.hbm2ddl.auto

    Hibernate in the configuration file: <properties> <property name="hibernate.hbm2ddl.auto" value="create" /> </ properties> Parameter Description: validate load hibernate, the authentication to create a database t ...

  • Build flex + spring + blazeds + hibernate application

    Build flex + spring + blazeds + hibernate application First, set up the project blazeds 1, will blazeds.war extract to a directory, such as: myflex /; 2, set up java works were such as: MyFlex, in the orientation of selection create project from exis ...

  • Hibernate connection pool configuration

    Hibernate connection pool configuration <! - Jdbc -> <property name="connection.driver_class"> oracle.jdbc.driver.OracleDriver </ property> <property name="connection.url"> jdbc: oracle: thin: @ 10.203.14.132:15

  • hibernate generic generic DAO

    package org.lzpeng.dao; import java.io.Serializable; import java.util.List; import org.hibernate.Criteria; import org.hibernate.Query; import org.hibernate.criterion.Criterion; import org.springside.modules.orm.hibernate.Page; /** * * @version 2009-1-10 *

  • can not be represented as java.sql.Timestamp

    Development of procedures for the use of hibernate when, some time there is no need to fill in the fields, but after the hibernate query time reported "Java.sql.SQLException: Value'0000-00-00 'can not be represented as java.sql.Timestamp ...

  • Struts2 + hibernate + spring problem user log in

    dao layer services layer action jsp <tr> <td align="center"> <b> user name: </ b> </ td> <td> <s: textfield name = "czyNumber" cssClass = "textstyle" theme = "simple" size = &q

  • Hibernate secondary cache

    Hibernate cache: 2-bit cache, also known as process-level cache or SessionFactory level cache, secondary cache can be shared by all of the session Cache configuration and the use of: Will echcache.xml (the document code in hibernate package directory ...

  • Hibernate's lazy strategy

    hibernate Lazy strategy can be used in: <class> tag, it can be true / false Tags can <PROPERTY> values true / false type of necessary tools to enhance <set> <list> can tag values true / false / extra <many-to-one> <on ...

blog comments powered by Disqus
Recent
Recent Entries
Tag Cloud
Random Entries