9.EASYUI ValidateBox 组件
2016-08-14 00:00
363 查看
一,基本验证框组件
二,定制验证框提示
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta charset="UTF-8"> <title>Basic NumberBox - jQuery EasyUI Demo</title> <link rel="stylesheet" type="text/css" href="../jquery-easyui-1.3.3/themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="../jquery-easyui-1.3.3/themes/icon.css"> <link rel="stylesheet" type="text/css" href="../css/demo.css"> <script type="text/javascript" src="../jquery-easyui-1.3.3/jquery.min.js"></script> <script type="text/javascript" src="../jquery-easyui-1.3.3/jquery.easyui.min.js"></script> <script type="text/javascript" src="../jquery-easyui-1.3.3/locale/easyui-lang-zh_CN.js"></script> </head> <body> <h2>基本验证框组件</h2> <div class="demo-info"> <div class="demo-tip icon-tip"></div> <div>我们可以很方便地添加验证逻辑到文本框里.</div> </div> <div style="margin:10px 0;"></div> <div class="easyui-panel" title="注册" style="width:400px;padding:10px"> <table> <tr> <td>用户名:</td> <td><input class="easyui-validatebox" data-options="required:true,validType:'length[3,10]'"></td> </tr> <tr> <td>Email:</td> <td><input class="easyui-validatebox" data-options="required:true,validType:'email'"></td> </tr> <tr> <td>出生日期:</td> <td><input class="easyui-datebox"></td> </tr> <tr> <td>URL:</td> <td><input class="easyui-validatebox" data-options="required:true,validType:'url'"></td> </tr> <tr> <td>电话:</td> <td><input class="easyui-validatebox" data-options="required:true"></td> </tr> </table> </div> </body> </html>
二,定制验证框提示
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta charset="UTF-8"> <title>Basic NumberBox - jQuery EasyUI Demo</title> <link rel="stylesheet" type="text/css" href="../jquery-easyui-1.3.3/themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="../jquery-easyui-1.3.3/themes/icon.css"> <link rel="stylesheet" type="text/css" href="../css/demo.css"> <script type="text/javascript" src="../jquery-easyui-1.3.3/jquery.min.js"></script> <script type="text/javascript" src="../jquery-easyui-1.3.3/jquery.easyui.min.js"></script> <script type="text/javascript" src="../jquery-easyui-1.3.3/locale/easyui-lang-zh_CN.js"></script> </head> <body> <h2>定制验证框提示</h2> <div class="demo-info"> <div class="demo-tip icon-tip"></div> <div>如何在验证框上显示另外一种提示信息.</div> </div> <div style="margin:10px 0;"></div> <div class="easyui-panel" title="注册" style="width:400px;padding:10px"> <table> <tr> <td>用户名:</td> <td><input class="easyui-validatebox" data-options="prompt:'请输入您的用户名.',required:true,validType:'length[3,10]'"></td> </tr> <tr> <td>Email:</td> <td><input class="easyui-validatebox" data-options="prompt:'请输入一个有效的Email.',required:true,validType:'email'"></td> </tr> <tr> <td>出生日期:</td> <td><input class="easyui-datebox"></td> </tr> <tr> <td>URL:</td> <td><input class="easyui-validatebox" data-options="prompt:'请输入您的URL.',required:true,validType:'url'"></td> </tr> <tr> <td>电话:</td> <td><input class="easyui-validatebox" data-options="prompt:'请输入您的电话号码.',required:true"></td> </tr> </table> </div> <script> $(function(){ $('input.easyui-validatebox').validatebox({ tipOptions: { // the options to create tooltip showEvent: 'mouseenter', hideEvent: 'mouseleave', showDelay: 0, hideDelay: 0, zIndex: '', onShow: function(){ if (!$(this).hasClass('validatebox-invalid')){ if ($(this).tooltip('options').prompt){ $(this).tooltip('update', $(this).tooltip('options').prompt); } else { $(this).tooltip('tip').hide(); } } else { $(this).tooltip('tip').css({ color: '#000', borderColor: '#CC9933', backgroundColor: '#FFFFCC' }); } }, onHide: function(){ if (!$(this).tooltip('options').prompt){ $(this).tooltip('destroy'); } } } }).tooltip({ position: 'right', content: function(){ var opts = $(this).validatebox('options'); return opts.prompt; }, onShow: function(){ $(this).tooltip('tip').css({ color: '#000', borderColor: '#CC9933', backgroundColor: '#FFFFCC' }); } }); }); </script> </body> </html>
相关文章推荐
- EasyUI - ValidateBox 验证组件
- Easyui dataGrid 动态insertRow 包含datebox、validatebox组件,样式失效问题
- easyui validatebox 验证类型
- easyui验证 validatebox属性【转载】
- easyui validatebox 验证集合
- easyui validatebox 验证类型
- easyui validatebox 验证类型
- Jquery Easyui验证组件ValidateBox使用详解(20)
- easyui validatebox 验证类型
- 扩展easyui validatebox的两个方法.移除验证和还原验证
- 使用Jquery validation组件对easyui-datebox组件的时间进行验证遇到的问题
- easyui validatebox 验证类型DEMO
- easyui-validatebox 验证
- 扩展easyui validatebox的两个方法.移除验证和还原验证
- 关于jquery easyui中easyui-validatebox自定义验证问题的解决
- easyui validatebox 验证类型
- 第二百一十一节,jQuery EasyUI,ValidateBox(验证框)组件
- easyui中validatebox的拓展验证类型
- Easyui validatebox修改——1.当text发生变化时在校验,2.取消校验,3扩展自定义验证
- Easyui中Validatebox控件和正则表达式