Chinaunix首页 | 论坛 | 博客
  • 博客访问: 235971
  • 博文数量: 48
  • 博客积分: 2500
  • 博客等级: 少校
  • 技术积分: 480
  • 用 户 组: 普通用户
  • 注册时间: 2008-07-24 11:02
文章分类

全部博文(48)

文章存档

2010年(33)

2009年(14)

2008年(1)

我的朋友

分类: Java

2010-07-07 21:22:46

1 下载livevalidation_standalone.js

 

2、目录结构:

       WebRoot

              javascript

                     livevalidation_standalone.js

registerform_validation.js

styles

       validation.css

              user

                     regist.jsp

3jsp页面

 

      

             

             

      

 

      

             

                    

                           

                                  

                                  

                           

                           

                                  

                                  

                           

                           

                                  

                                  

                           

                           

                                  

                                  

                           

                           

                                  

                                  

                           

                           

                                  

                                  

                           

                           

                                  

                                  

                           

                           

                                  

                           

                    

                                          User Name

                                          *

                                  

                                          id="username" />

                                  

                                          Password

                                          *

                                  

                                          id="password" />

                                  

                                          Confirm Password

                                          *

                                  

                                          id="repassword" />

                                  

                                          Telephone

                                  

                                          id="phone" />

                                  

                                          Email

                                  

                                          id="email" />

                                  

                                          Address

                                  

                                          id="address" />

                                  

                                          Post Code

                                  

                                          id="postcode" />

                                  

                                         

                                               

                                         

                                  

             

 

             

      

 

4validation.css内容

.LV_validation_message{

       font-size: x-small;

    font-weight:bold;

    margin:0 0 0 5px;

}

 

.LV_valid {

    color:#00CC00;

}

      

.LV_invalid {

    color:#CC0000;

}

   

.LV_valid_field,

input.LV_valid_field:hover,

input.LV_valid_field:active,

textarea.LV_valid_field:hover,

textarea.LV_valid_field:active {

    border: 1px solid #00CC00;

}

   

.LV_invalid_field,

input.LV_invalid_field:hover,

input.LV_invalid_field:active,

textarea.LV_invalid_field:hover,

textarea.LV_invalid_field:active {

    border: 1px solid #CC0000;

}

 

4registerform_validation.js内容

var username = new LiveValidation('username');

username.add(Validate.Presence);

 

var password = new LiveValidation('password');

password.add(Validate.Presence);

 

var repassword = new LiveValidation('repassword');

repassword.add(Validate.Presence);

repassword.add(Validate.Confirmation, {match: 'password'});

 

var email = new LiveValidation('email');

email.add(Validate.Email);

阅读(2209) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~