原生js图形验证码
点击验证码刷新为新的字符
XML/HTML Code
- <div id="v_container"></div>
- <input type="text" id="code_input" value="" placeholder="请输入验证码" /><button id="my_button">验证</button>
JavaScript Code
- <script>
- var verifyCode = new GVerify("v_container");
- console.log(verifyCode)
- document.getElementById("my_button").onclick = function(){
- var res = verifyCode.validate(document.getElementById("code_input").value);
- if(res){
- alert("验证正确");
- }else{
- alert("验证码错误");
- }
- }
- </script>
原文地址:http://www.freejs.net/article_biaodan_795.html