Register step by step. Enter the required information for the next demonstration.
XML/HTML Code
- <Div id = "form">
- <Form method = "post">
- <Ul>
- <Li class = "email">
- <Label> Email: </label> <br/>
- <Input type = "text" name = "email" id = "email"/>
- <Span class = "error"> </span>
- </Li>
- <Li class = "username">
- <Label> Username: </label> <br/>
- <Input type = "text" name = "name" id = "username"/>
- <Span class = "error"> </span>
- </Li>
- <Li class = "password">
- <Label> Password: </label> <br/>
- <Input type = "password" name = "password" id = "password"/>
- <Span class = "error"> </span>
- </Li>
- <Li class = "submit">
- <Input type = "submit" value = "Register" id = 'submit '/>
- </Li>
- </Ul>
- </Form>
- </Div>
JavaScript Code
- <Script type = "text/javascript">
- $ (Function ()
- {
- $ ("Ul li: first"). show ();
- Var ck_username =/^ [A-Za-z0-9 _] {} $ /;
- Var ck_email =/^ [a-zA-Z0-9. _-] + @ [a-zA-Z0-9-] + \. [a-zA-Z.] {} $ /;
- $ ('# Email'). change (function ()
- {
- Var email = $ (this). val ();
- If (! Ck_email.test (email ))
- {
- Certificate (this).next().show().html ("Enter valid email ");
- }
- Else
- {
- $ (This). next (). hide ();
- $ ("Li"). next ("li. username"). slideDown ({duration: 'low', easing: 'easeoutelastic '});
- }
- });
- $ ('# Username'). keyup (function ()
- {
- Var username = $ (this). val ();
- If (! Ck_username.test (username ))
- {
- Certificate (this).next().show().html ("Min 3 charts no Space ");
- }
- Else
- {
- $ (This). next (). hide ();
- $ ("Li"). next ("li. password"). slideDown ({duration: 'low', easing: 'easeoutelastic '});
- }
- });
- $ ('# Password'). keyup (function ()
- {
- Var password = $ (this). val ();
- If (! Ck_password.test (password ))
- {
- Certificate (this).next().show().html ("Min 6 Charts ");
- }
- Else
- {
- $ (This). next (). hide ();
- $ ("Li"). next ("li. submit"). slideDown ({duration: 'low', easing: 'easeoutelastic '});
- }
- });
- $ ('# Submit'). click (function ()
- {
- Var email = $ ("# email"). val ();
- Var username = $ ("# username"). val ();
- Var password = $ ("# password"). val ();
- If (ck_email.test (email) & ck_username.test (username) & ck_password.test (password ))
- {
- $ ("# Form" pai.show().html ("
- }
- Else
- {
- }
- Return false;
- });
- })
- </Script>
Address: http://www.freejs.net/article_biaodan_139.html