1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>网站注册页面</title>
  6. <style>
  7. #contanier{
  8. border: 0px solid white;
  9. width: 1300px;
  10. margin: auto;
  11. }
  12. #top{
  13. border: 0px solid white;
  14. width: 100%;
  15. height: 50px;
  16. }
  17. #menu{
  18. border: 0px solid white;
  19. height: 40px;
  20. background-color: black;
  21. padding-top: 10px;
  22. margin-bottom: 15px;
  23. margin-top: 10px;
  24. }
  25. .top{
  26. border: 0px solid white;
  27. width: 405px;
  28. height: 100%;
  29. float: left;
  30. padding-left: 25px;
  31. }
  32. #top1{
  33. padding-top: 15px;
  34. }
  35. #bottom{
  36. margin-top: 13px;
  37. text-align: center;
  38. }
  39. #form{
  40. height: 500px;
  41. padding-top: 70px;
  42. background-image: url(../img/regist_bg.jpg);
  43. margin-bottom: 10px;
  44. }
  45. a{
  46. text-decoration: none;
  47. }
  48. label.error{
  49. background:url(../img/unchecked.gif) no-repeat 10px 3px;
  50. padding-left: 30px;
  51. font-family:georgia;
  52. font-size: 15px;
  53. font-style: normal;
  54. color: red;
  55. }
  56. label.success{
  57. background:url(../img/checked.gif) no-repeat 10px 3px;
  58. padding-left: 30px;
  59. }
  60. #father{
  61. border: 0px solid white;
  62. padding-left: 307px;
  63. }
  64. #form2{
  65. border: 5px solid gray;
  66. width: 660px;
  67. height: 450px;
  68. }
  69. </style>
  70. <script type="text/javascript" src="../js/jquery-1.11.0.min.js" charset="UTF-8"></script>
  71. <script type="text/javascript" src="../js/jquery.validate.min.js" charset="UTF-8"></script>
  72. <script type="text/javascript" src="../js/messages_zh.js" charset="UTF-8"></script>
  73. <script>
  74. $(function() {
  75. $("#registForm").validate({
  76. rules:{
  77. user:{
  78. required:true,
  79. minlength:3
  80. },
  81. password:{
  82. required:true,
  83. digits: true,
  84. minlength:6
  85. },
  86. repassword:{
  87. required:true,
  88. equalTo: "[name='password']"
  89. },
  90. email:{
  91. required:true,
  92. email: true
  93. },
  94. username:{
  95. required:true,
  96. minlength:3,
  97. maxlength:5
  98. },
  99. sex: {
  100. required: true
  101. }
  102. },
  103. messages:{
  104. user:{
  105. required:"用户名不能为空!",
  106. minlength:"用户名不得少于3位!"
  107. },
  108. password:{
  109. required:"密码不能为空!",
  110. digits: "密码必须是数字",
  111. minlength:"密码不能少于6位"
  112. },
  113. repassword:{
  114. required:"确认密码不能为空!",
  115. equalTo: "两次输入密码不一致!"
  116. },
  117. email:{
  118. required:"邮箱不能为空",
  119. email: "邮箱格式不支持"
  120. },
  121. username:{
  122. required:"姓名不能为空!",
  123. minlength:"姓名不得少于3位!",
  124. maxlength:"姓名不超过5位!"
  125. },
  126. sex: {
  127. required: "性别必须勾选!"
  128. }
  129. },
  130. errorElement: "label", //用来创建错误提示信息标签
  131. success: function(label) { //验证成功后的执行的回调函数
  132. //label指向上面那个错误提示信息
  133. label.text(" ") //清空错误提示信息
  134. .addClass("success"); //加上自定义success类
  135. }
  136. });
  137. });
  138. </script>
  139. </head>
  140. <body>
  141. <div id="contanier">
  142. <div id="top">
  143. <div class="top">
  144. <img src="../img/logo2.png" height="47px"/>
  145. </div>
  146. <div class="top">
  147. <img src="../img/header.png" height="45px" />
  148. </div>
  149. <div class="top" id="top1">
  150. <a href="#">登录</a>
  151. <a href="#">注册</a>
  152. <a href="#">购物车</a>
  153. </div>
  154. </div>
  155. <div id="menu">
  156. <a href="#"><font size="5" color="white">首页</font></a>&nbsp;&nbsp;&nbsp;&nbsp;
  157. <a href="#"><font color="white">电脑办公</font></a>&nbsp;&nbsp;&nbsp;&nbsp;
  158. <a href="#"><font color="white">手机数码</font></a>&nbsp;&nbsp;&nbsp;&nbsp;
  159. <a href="#"><font color="white">鞋靴箱包</font></a>
  160. </div>
  161. <div id="form">
  162. <form action="#" method="get" id="registForm">
  163. <div id="father">
  164. <div id="form2">
  165. <table border="0px" width="100%" height="100%" align="center" cellpadding="0px" cellspacing="0px" bgcolor="white">
  166. <tr>
  167. <td colspan="2" >
  168. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  169. <font size="5">会员注册</font>&nbsp;&nbsp;&nbsp;USER REGISTER
  170. </td>
  171. </tr>
  172. <tr>
  173. <td width="180px">
  174. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  175. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  176. <label for="user" >用户名</label>
  177. </td>
  178. <td>
  179. <em style="color: red;">*</em>&nbsp;&nbsp;&nbsp;<input type="text" name="user" size="35px" id="user"/>
  180. </td>
  181. </tr>
  182. <tr>
  183. <td>
  184. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  185. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  186. 密码
  187. </td>
  188. <td>
  189. <em style="color: red;">*</em>&nbsp;&nbsp;&nbsp;<input type="password" name="password" size="35px" id="password" />
  190. </td>
  191. </tr>
  192. <tr>
  193. <td>
  194. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  195. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  196. 确认密码
  197. </td>
  198. <td>
  199. <em style="color: red;">*</em>&nbsp;&nbsp;&nbsp;<input type="password" name="repassword" size="35px"/>
  200. </td>
  201. </tr>
  202. <tr>
  203. <td>
  204. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  205. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  206. Email
  207. </td>
  208. <td>
  209. <em style="color: red;">*</em>&nbsp;&nbsp;&nbsp;<input type="text" name="email" size="35px" id="email"/>
  210. </td>
  211. </tr>
  212. <tr>
  213. <td>
  214. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  215. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  216. 姓名
  217. </td>
  218. <td>
  219. <em style="color: red;">*</em>&nbsp;&nbsp;&nbsp;<input type="text" name="username" size="35px"/>
  220. </td>
  221. </tr>
  222. <tr>
  223. <td>
  224. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  225. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  226. 性别
  227. </td>
  228. <td>
  229. <span style="margin-right: 155px;">
  230. <em style="color: red;">*</em>&nbsp;&nbsp;&nbsp;<input type="radio" name="sex" value="男"/>
  231. <input type="radio" name="sex" value="女"/><em></em>
  232. </span>
  233. <label for="sex" class="error" style="display: none;"></label>
  234. </td>
  235. </tr>
  236. <tr>
  237. <td>
  238. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  239. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  240. 出生日期
  241. </td>
  242. <td>
  243. <em style="color: red;">*</em>&nbsp;&nbsp;&nbsp;<input type="text" name="birthday" size="35px"/>
  244. </td>
  245. </tr>
  246. <tr>
  247. <td>
  248. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  249. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  250. 验证码
  251. </td>
  252. <td>
  253. <em style="color: red;">*</em>&nbsp;&nbsp;&nbsp;<input type="text" name="yanzhengma" />
  254. <img src="../img/yanzhengma.png" style="height: 18px;width: 85px;"/>
  255. </td>
  256. </tr>
  257. <tr>
  258. <td colspan="2">
  259. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  260. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  261. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  262. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  263. <input type="submit" value="注 册" height="50px"/>
  264. </td>
  265. </tr>
  266. </table>
  267. </div>
  268. </div>
  269. </form>
  270. </div>
  271. </div>
  272. </body>
  273. </html>

JQuery之validate入门的更多相关文章

  1. 基于jQuery的Validate表单验证

    表单验证可以说在前端开发工作中是无处不在的~ 有数据,有登录,有表单, 都需要前端验证~~  而我工作中用到最多的就是基于基于jQuery的Validate表单验证~  就向下面这样~ 因为今天有个朋 ...

  2. jquery插件开发基础入门

    jquery插件开发基础入门 入门 编写一个jquery插件开始于给jquery.fn加入新的功能属性,此处添加的对象属性的名称就是你的插件名称 jQuery.fn,myPlugin = functi ...

  3. 简单地使用jquery的validate

    简单地使用jquery的validate ——@梁WP 摘要:本文通过一个很简单的例子,讲解了jquery validate的最基础使用方式. 一.源代码 注意事项都写在代码的注释里了,哈哈. < ...

  4. jquery插件-validate

    1.引入js,css 下载地址:http://plugins.jquery.com/validate/ 2.设置验证规则:input的class添加以下验证属性 3.设置不符合规则的提示信息:添加da ...

  5. 使用jquery插件validate制作的表单验证案例

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  6. jQuery validate入门

    <html> <head> <meta charset="utf8"></meta> </head> <body& ...

  7. jQuery校验validate详解(转)

    jQuery校验 官网地址:http://bassistance.de/jquery-plugins/jquery-plugin-validation 一导入js库 <script src=&q ...

  8. jquery的validate.js 和 form.js 的使用方法

    在使用 Jquery 的方法的验证并且修改 原Form 表单的提交方式的时候,需要引用的文件有 <script type="text/javascript" src=&quo ...

  9. JQuery插件validate的Remote使用

    JQuery.validate.js 在表单验证中经常使用,初学,对于其中Remote的使用说明一下. 1. 基本解释 JQuery主要用于DOM树和CSS树的检索和后面的操作的一套方法,JQuery ...

随机推荐

  1. uc浏览器的用户体验

    用户界面: 我认为,uc浏览器的用户界面还是很招人喜欢的,可以很容易让用户找到自己想看的网页.简单快捷. 记住用户的选择: uc在每次用户访问完网站之后都会记住用户访问的高频网站,以便下次用户可以更好 ...

  2. Python:print()函数的几个常用参数

    1.参数sep:设置输出字符产之间的字符串.默认是空格 name='Tomwenxing' age=' job='student' print(name,age,job) print(name,age ...

  3. 软工1816 · Alpha冲刺(8/10)

    团队信息 队名:爸爸饿了 组长博客:here 作业博客:here 组员1(组长):王彬 过去两天完成了哪些任务 推进前后端各个接口的整合 学习jQuery基本语法,为beta阶段的商铺页面做准备 接下 ...

  4. HDU 5167 Fibonacci 筛法+乱搞

    题目链接: hdu: http://acm.hdu.edu.cn/showproblem.php?pid=5167 题意: 给你一个x,判断x能不能由斐波那契数列中的数相乘得到(一个数可以重复使用) ...

  5. 蜗牛慢慢爬 LeetCode 2. Add Two Numbers [Difficulty: Medium]

    题目 You are given two non-empty linked lists representing two non-negative integers. The digits are s ...

  6. React.js + LiveReload配置详解

    一.介绍一下LiveReload: LiveReload monitors changes in the file system. As soon as you save a file, it is ...

  7. session的基本原理

    转载:http://blog.sina.com.cn/s/blog_8155e74d0101iqmh.html 如何严格限制session在30分钟后过期! 1.设置客户端cookie的lifetim ...

  8. python 小数保留位数

    利用round(number[, ndigit] )函数四舍五入 保留浮点数的小数点. 如保留小数点后两位. num = 9.2174 new_num = round( num , 2 ) 则new_ ...

  9. 【前端学习笔记03】JavaScript对象相关方法及封装

    //Object.create()创建对象 var obj = Object.create({aa:1,bb:2,cc:'c'}); obj.dd = 4; console.log(obj.cc); ...

  10. C++四种类型转化

    2018-08-02 (星期四)C++类型转换:static_cast提供编译时期静态类型检测:    static_cast <type-id> (expression)    1)完成 ...