`

jQuery.validity表单校验

阅读更多

jQuery.validity表单校验

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>set your title</title>
<script type="text/javascript" src="../jquery-1.4.3.js"></script>
<link type="text/css" rel="Stylesheet" href="jquery.validity.css" />
<script type="text/javascript" src="jquery.validity.js"></script>

<script type="text/javascript">
	$(function() {
		$("#testform").validity(function() {
				$("#username")
				.require("用户名不能为空")
				.match(/^\w+$/, "必须是数字或者字母")
				.maxLength(12, "长度必须<=12")//不支持长度必须小于#{max}
				.minLength(6, "长度必须>=6");//不支持长度必须大于#{min}
				
				$("#password2")
				.require("确认密码不能为空")
				.match(/^\w+$/, "必须是数字或者字母")
				.equal(function(val) { 
				    return $("#password").val();
				},"密码不匹配");

				$("#birthday")
				.require("生日不能为空")
				.match("date");
				.lessThanOrEqualTo(new Date())

		});
	});
</script>

</head>

<body>
<p><a href="./">上一级</a> </p>
<hr/>
<input type="button" name="btnTest" id="btnTest" value="点击测试" />
<hr/>

<div id="content">
	<form action="" method="get" id="testform">

		<p>
			用户名:
			    <input type="text" name="username" id="username" />
		</p>
		<p>
			密码:
			<input type="text" name="password" id="password" />
		</p>
		<p>密码确认:
            <input type="text" name="password2" id="password2" />
        </p>
		<p>生日:
            <input type="text" name="birthday" id="birthday" />
            (mm/dd/yyyy) </p>
		<p>邮箱:
            <input type="text" name="email" id="email" />
        </p>
		<p>QQ:
            <input type="text" name="qq" id="qq" />
        </p>
		<p>
		    <input type="submit" name="button" id="button" value="提交" />
		</p>
	</form>
</div>

	</body>
</html>

 

http://validity.thatscaptaintoyou.com


密码和密码确认不知道如何校验它们是否相等,因此抛弃这个检验框架,大喜大悲

如果有路过的高手,请指点.

分享到:
评论
2 楼 dufan168 2011-01-18  
用$("input[type='password']").equal("密码不匹配");试试
1 楼 macrotea 2010-11-18  
选择比努力重要!

相关推荐

    jQuery表单验证插件 jQuery.validity

    jQuery表单验证插件 jQuery.validity

    基于jquery的表单验证框架

    基于jquery的表单验证框架,基于jquery的表单验证框架,基于jquery的表单验证框架.

    validity:jQuery的客户端验证

    jQuery.validity 有效性不必手动编写验证或平衡某些笨拙的服务器端框架,而使您可以以自然而直接的方式设计客户端验证。 jQuery.validity易于学习和使用。 它完全适用于简单的验证方案,但它也设计用于干净自然地...

    jquery内置验证(validate)使用方法示例(表单验证)

    主要介绍了jquery内置验证(validate)使用方法示例,在做表单验证的时候可以用到,下面看代码使用方法

    jQuery表单课堂笔记

    jQuery的定义/特点: jQ的语法结构; 选择器: jQuery事件 jQuery方法 正则表达式 RegExp对象 validity属性

    validity.js:JavaScript 模型的验证框架

    通过Validity.RULES字典轻松添加新的站点范围的验证器。 适用于 jQuery 和 Angular.js 例子 # Define a class with some validation rules class Person Validity . define @ , name : ' required ' email : {...

    Validity 指纹驱动程序.exe

    驱动程序,hp的elitebook 系列指纹驱动程序!

    XML终极教程(PDF)

    This appendix contains XML reference material. It is divided into three main parts: 1. XML BNF Grammar 2. Well-Formedness Constraints 3. Validity Constraints

    Short Message peer to peer Protocol specification v3.4

    SMPP 协议 3.4, 英文版, 可选择。 Table of Contents 1. Introduction.................................................................................................................8 ...

    Direct assessment of behavioral and emotional problems

    Concurrent validity of the McCarthy Scales of Children's Abilities. Measurement DAVIS, E. E., & ROWLAND, T. A replacement for the venerable Stanford-Binet? Journal of Clinical and Evaluation in ...

    直接评估行为和情绪问题

    Concurrent validity of the McCarthy Scales of Children's Abilities. Measurement DAVIS, E. E., & ROWLAND, T. A replacement for the venerable Stanford-Binet? Journal of Clinical and Evaluation in ...

    Validity90, 有效/synaptics 138a的反向工程.zip

    Validity90, 有效/synaptics 138a的反向工程 Validity90本项目的目的是对有效的138 a:0090, 138 a:0094, 138 a:0097, 06: 0081.指纹读取器进行反向工程,创建规范和牙线libfprint驱动程序。讨论这里项目的主要聊天:...

    linux_check_password_complex_validity-2.xml

    linux_check_password_complex_validity-2.xml

    Nonverbal ability and hearing impaired

    Validity of the Woodcock-Johnson Tests of Cognitive Ability: A comparison with the WISC-R in LD and normal elementary students. Journal of School Psychology, THOMPSON, P., B BRASSARD, M. (1984b). ...

    非语言能力和听力障碍

    Validity of the Woodcock-Johnson Tests of Cognitive Ability: A comparison with the WISC-R in LD and normal elementary students. Journal of School Psychology, THOMPSON, P., B BRASSARD, M. (1984b). ...

    pandas_validity-0.1.0.tar.gz

    Python库是一组预先编写的代码模块,旨在帮助开发者实现特定的编程任务,无需从零开始编写代码。这些库可以包括各种功能,如数学运算、文件操作、数据分析和网络编程等。Python社区提供了大量的第三方库,如NumPy、...

    pandas_validity-0.1.1.tar.gz

    Python库是一组预先编写的代码模块,旨在帮助开发者实现特定的编程任务,无需从零开始编写代码。这些库可以包括各种功能,如数学运算、文件操作、数据分析和网络编程等。Python社区提供了大量的第三方库,如NumPy、...

    Construct validity in TOEFL iBT speaking tasks

    language testing 权威刊物文章 可供语言测试与学习者使用。

    i2c总线协议英文版

    6.1 Data validity . . . . . . . . . . . . . . . . . . . . . . . . 8 6.2 START and STOP conditions . . . . . . . . . . . 9 7 TRANSFERRING DATA . . . . . . . . . . . . . . .10 7.1 Byte format . . . . . ...

    Validity 有效性指纹传感器原型_Python_代码_相关文件_下载

    有效性指纹传感器驱动程序。 目录 python-有效性 配置 错误情况 列出设备失败 启动时出错 从挂起唤醒后指纹不工作 启用指纹以进行系统身份验证 pam-auth-update 的实际变化 ...更多详情、使用方法,请下载后细读README...

Global site tag (gtag.js) - Google Analytics