views:

125

answers:

3

Hello everybody, 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 Javascript .

Thanks !!

+1  A: 

That doesn't make sense... without a backend check, the captcha is useless. bots don't use javascript anyway. All you'd be accomplishing is to annoy your users.

DGM
+2  A: 

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.

Topera
yes, it is a chaptcha:) .. but for more details, I need to make this capcha like a standard one, like some letters numbers, with some background. I know that it is unless , but I need just to show that this captcha exist and looks like a real captcha :) Thanks
Alexander Corotchi
A: 

Do you want to add CAPTCHA just because it sounds geeky? Don't use it unless it is really needed.

Ashit Vora