之前有提到jQuery,
Prototype 上实现表单验证. 这里介绍一个更轻型的.....
jsvalidate 是一个表单验证框架,使用起来非常简单只需引入框架JS后指定相应的表单元素的Class即可实现验证,非常方便,下面是其支持的一些Class,当然你也可以自己建立需要的Class:
jsrequired - Field must have some sort of value.
jsvalidate_number - Any integer; accepts decimal and negative
jsvalidate_digits - Only Numbers
jsvalidate_alpha - Only letters
jsvalidate_alphanum - Only letters, numbers, and underscores.
jsvalidate_email - Any valid email address.
jsvalidate_uscanzip - US or Canada Zip code; Accepts optional US zip + 4
jsvalidate_usstate - Any 2 letter uppercase state of the United States.
jsvalidate_usphone - US Phone Number, accepts most common formats.
jsvalidate_creditcard - Validates VISA, MasterCard, American Express; formats: no spaces, spaces, or dashes.
jsvalidate_ssn - Social Security Number in the format: XXXXXXXXX, XXX XX XXXX, or XXX-XX-XXXXX
select-notfirst - This class can be applied to select boxes (drop-downs). It prohibits the user from selecting the first option from the list.