jQuery表单验证插件 baigoValidator

码农软件 · 软件分类 · jQuery对话框 · 2019-12-14 15:29:23

软件介绍

baigoValidator 是基于 jQuery 的表单验证插件。在线演示


文件结构:


  1. baigoValidator.js 验证插件

  2. baigoValidator.css CSS 样式

  3. status_x.png 验证失败时的图标

  4. status_y.png 验证成功时的图标

  5. loading.gif 正在验证图标

  6. readme.txt 使用说明


使用方法:


  1. 载入 jQuery 库文件,jQuery 库文件请到 http://www.jquery.com 下载,例:

    <script src="jquery.js" type="text/javascript"></script>

    载入 baigoValidator 样式表,例:

    <link href="baigoValidator.css" type="text/css" rel="stylesheet" />

    载入 baigoValidator 核心文件,例:

    <script src="baigoValidator.js" type="text/javascript"></script>


  2. 初始化 baigoValidator,fileds_set 为配置参数,类型为 JSON,名称可以自定义,例:

    <script type="text/javascript">$(document).ready(function(){
    	obj_form = $("#form_id").baigoValidator(fileds_set);
    });</script>


  3. 配置参数,具体请参考 配置参数说明,例:

    <script type="text/javascript">var fileds_set = {
    	name: {
    		length: { min: 1, max: 100 },
    		validate: { type: "str", format: "text" },
    		msg: { id: "msg_prj_status", too_short: "太短", too_long: "太长" }
    	},
    	no: {
    		length: { min: 4, max: 4 },
    		validate: { type: "str", format: "int" },
    		msg: { id: "msg_prj_status", too_short: "太短", too_long: "太长" }
    	},
    	email: {
    		length: {min: 1, max: 0 },
    		validate: { type: "str", format: "email" },
    		msg: { id: "msg_prj_status", too_short: "太短" }
    	},
    	digit: {
    		length: { min: 1, max: 0 },
    		validate: { type: "digit", format: "int" },
    		msg: { id: "msg_prj_status", too_short: "太短" }
    	},
    	checkbox: {
    		length: { min: 1, max: 0 },
    		validate: { type: "checkbox" },
    		msg: { id: "msg_prj_status", too_few: "太少" }
    	},
    	user_name: {
    		length: { min: 1, max: 0 },
    		validate: { type: "ajax" },
    		msg: { id: "msg_prj_status", too_few: "太少" }
    		ajax: { url: "http://www.nbfone.com/ajax/", key: "user_name", "type" : "str" }
    	}
    }</script>


  4. 定义需要验证的字段 id 或 group,此处需与 配置参数 中的定义一致,例:

    <input type="text" id="name" /><input type="checkbox" id="name" group="test" />


  5. 定义需要验证的表单项的 class,class 的值必须为 validate,例:

    <input type="text" id="name" class="validate" /><input type="text" id="name" group="test" class="validate" />


  6. 触发验证,例:

    <script type="text/javascript">var obj_form = $("#cate_form").baigoValidator(fileds_set);$("#cate_form").submit(function(){
    	obj_form.validateSubmit();
    });</script>



本文地址:https://codercto.com/soft/d/21138.html

Linux程序设计

Linux程序设计

Neil Matthew、Richard Stones / 陈健、宋健建 / 人民邮电出版社 / 201005 / 99.00元

时至今日,Linux系统已经从一个个人作品发展为可以用于各种关键任务的成熟、高效和稳定的操作系统,因为具备跨平台、开源、支持众多应用软件和网络协议等优点,它得到了各大主流软硬件厂商的支持,也成为广大程序设计人员理想的开发平台。 本书是Linux程序设计领域的经典名著,以简单易懂、内容全面和示例丰富而受到广泛好评。中文版前两版出版后,在国内的Linux爱好者和程序员中也引起了强烈反响,这一热潮......一起来看看 《Linux程序设计》 这本书的介绍吧!

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具