Pure JavaScript/jQuery/HTML captcha

后端 未结 8 1495
离开以前
离开以前 2021-01-14 04:54

can somebody sent me a link, or to provide me an example with pure Javascript/jQuery captcha. Because I can see a lots of examples with PHP/C# ... back end. But I need just

相关标签:
8条回答
  • 2021-01-14 05:16

    There is a tutorial on jQuery with captcha located here; http://www.tutorialcadet.com/jquery-advanced-ajax-validation-with-captcha/

    0 讨论(0)
  • 2021-01-14 05:23

    I think this is not a good idea, because if validation is made in client (js), somebody can make a script to read the correct answer.


    EDIT

    Anyway, if you want a useless captcha, you can play with this:

    See in jsfiddle.

    HTML

    Pseudo-Human check.
    
    <br/>How much is: <input type="text" id="a"/>
    <br/>Answer:<input type="text" id="b"/>
    
    <br/>
    <input type="button" id="c" value="Go!"/>
    

    JS

    $(document).ready(function() {
        var n1 = Math.round(Math.random() * 10 + 1);
        var n2 = Math.round(Math.random() * 10 + 1);
        $("#a").val(n1 + " + " + n2);
        $("#c").click(function() {
            if (eval($("#a").val()) == $("#b").val()) {
                alert("Ok! You are human!");
            } else {
                alert("error");
            }
        });
    });
    

    EDIT 2:

    My "captcha" hack:

    // captcha hack
    $(document).ready(function() {
         $("#b").val(eval($("#a").val()));
    });
    

    See in jsfiddle.

    0 讨论(0)
提交回复
热议问题