数学公式验证码
給出簡單的數學算法(加減法運算),計算結果為驗證碼。
效果演示
原始樣式
點擊換一張或者點擊驗證碼圖片的時候隨機生成新的數學驗證碼
輸入錯誤的驗證碼
輸入正確的驗證碼
代碼演示
注意:引入兩個架包
<script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/verify.js"></script>代碼
<!DOCTYPE html> <html><head><meta charset="utf-8"><title></title><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/verify.js"></script></head><style>/*常規驗證碼*/.verify-code {font-size: 20px;text-align: center;cursor: pointer;margin-bottom: 5px;border: 1px solid #ddd;}.varify-input-code {display:inline-block; width: 100%;height: 25px;}.verify-change-code {color: #337AB7;cursor: pointer;}.verify-btn {width: 200px;height: 30px;background-color: #337AB7;color:#FFFFFF;border:none;margin-top: 10px;}</style><body><div id="mpanel3" style="margin-top: 20px"></div><button type="button" id="check-btn2" class="verify-btn">確定</button></body><script type="text/javascript">$('#mpanel3').codeVerify({type: 2,figure: 100, //位數,僅在type=2時生效arith: 0, //算法,支持加減乘,不填為隨機,僅在type=2時生效width: '200px',height: '50px',fontSize: '30px',btnId: 'check-btn2',ready: function() {},success: function() {alert('驗證匹配!');},error: function() {alert('驗證碼不匹配!');}});</script> </html>總結
- 上一篇: 电大计算机一级b考试试题,电大计算机考试
- 下一篇: 审查元素找不到创建的元素_香奈儿除了珍珠