index.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <!DOCTYPE html>
  2. <html lang="zh-cn">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
  6. <title>verify插件demo</title>
  7. <link rel="stylesheet" type="text/css" href="css/verify.css">
  8. </head>
  9. <body>
  10. <h1>verify</h1>
  11. <p>纯前端的验证码插件,大熊出品</p>
  12. <br><br>
  13. <h3>普通验证码</h3>
  14. <div id="mpanel2" >
  15. </div>
  16. <button type="button" id="check-btn" class="verify-btn">确定</button>
  17. <div id="mpanel3" style="margin-top: 20px">
  18. </div>
  19. <button type="button" id="check-btn2" class="verify-btn">确定</button>
  20. <h3>滑动验证码</h3>
  21. <div id="mpanel1" >
  22. </div>
  23. <div id="mpanel4" style="margin-top:50px;">
  24. </div>
  25. <h3>点选验证码</h3>
  26. <div id="mpanel5" style="margin-top:50px;">
  27. </div>
  28. <div id="mpanel6" style="margin-top:50px;">
  29. </div>
  30. <script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
  31. <script type="text/javascript" src="js/verify.js" ></script>
  32. <!--<script type="text/javascript" src="js/verify.min.js" ></script>-->
  33. <script>
  34. $('#mpanel2').codeVerify({
  35. type : 1,
  36. width : '400px',
  37. height : '50px',
  38. fontSize : '30px',
  39. codeLength : 6,
  40. btnId : 'check-btn',
  41. ready : function() {
  42. },
  43. success : function() {
  44. alert('验证匹配!');
  45. },
  46. error : function() {
  47. alert('验证码不匹配!');
  48. }
  49. });
  50. $('#mpanel3').codeVerify({
  51. type : 2,
  52. figure : 100, //位数,仅在type=2时生效
  53. arith : 0, //算法,支持加减乘,不填为随机,仅在type=2时生效
  54. width : '200px',
  55. height : '50px',
  56. fontSize : '30px',
  57. btnId : 'check-btn2',
  58. ready : function() {
  59. },
  60. success : function() {
  61. alert('验证匹配!');
  62. },
  63. error : function() {
  64. alert('验证码不匹配!');
  65. }
  66. });
  67. $('#mpanel1').slideVerify({
  68. type : 1, //类型
  69. vOffset : 5, //误差量,根据需求自行调整
  70. barSize : {
  71. width : '80%',
  72. height : '40px',
  73. },
  74. ready : function() {
  75. },
  76. success : function() {
  77. alert('验证成功,添加你自己的代码!');
  78. //......后续操作
  79. },
  80. error : function() {
  81. // alert('验证失败!');
  82. }
  83. });
  84. $('#mpanel4').slideVerify({
  85. type : 2, //类型
  86. vOffset : 5, //误差量,根据需求自行调整
  87. vSpace : 5, //间隔
  88. imgName : ['1.jpg', '2.jpg'],
  89. imgSize : {
  90. width: '400px',
  91. height: '200px',
  92. },
  93. blockSize : {
  94. width: '40px',
  95. height: '40px',
  96. },
  97. barSize : {
  98. width : '400px',
  99. height : '40px',
  100. },
  101. ready : function() {
  102. },
  103. success : function() {
  104. alert('验证成功,添加你自己的代码!');
  105. //......后续操作
  106. },
  107. error : function() {
  108. // alert('验证失败!');
  109. }
  110. });
  111. $('#mpanel5').pointsVerify({
  112. defaultNum : 4, //默认的文字数量
  113. checkNum : 2, //校对的文字数量
  114. vSpace : 5, //间隔
  115. imgName : ['1.jpg', '2.jpg'],
  116. imgSize : {
  117. width: '600px',
  118. height: '200px',
  119. },
  120. barSize : {
  121. width : '600px',
  122. height : '40px',
  123. },
  124. ready : function() {
  125. },
  126. success : function() {
  127. alert('验证成功,添加你自己的代码!');
  128. //......后续操作
  129. },
  130. error : function() {
  131. // alert('验证失败!');
  132. }
  133. });
  134. $('#mpanel6').pointsVerify({
  135. defaultNum : 4, //默认的文字数量
  136. checkNum : 2, //校对的文字数量
  137. vSpace : 5, //间隔
  138. imgName : ['1.jpg', '2.jpg'],
  139. imgSize : {
  140. width: '600px',
  141. height: '200px',
  142. },
  143. barSize : {
  144. width : '600px',
  145. height : '40px',
  146. },
  147. ready : function() {
  148. },
  149. success : function() {
  150. alert('验证成功,添加你自己的代码!');
  151. //......后续操作
  152. },
  153. error : function() {
  154. // alert('验证失败!');
  155. }
  156. });
  157. </script>
  158. </body>
  159. </html>