Last active
September 1, 2015 13:30
-
-
Save Avelar/c124651134802d41afc7 to your computer and use it in GitHub Desktop.
Reverse Captcha Basic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--A basic Reverse Captcha contact form--> | |
<form id="formAntiSpam" action="" method=""> | |
<input type="text" name="nome" value="" tabindex="1"> | |
<input type="text" name="email" value="" tabindex="2"> | |
<!--The spambot test field is hidden and no has a tabindex--> | |
<input type="button" class="spam-test-field" style="display:none" value=""> | |
<button type="button" onclick="spamVerify()" tabindex="3"> Send Form </button> | |
</form> | |
<script type="text/javascript"> | |
function spamVerify(evt) { | |
// get the spambot test field value | |
var getString = document.querySelector(".spam-test-field").value; | |
// the test if the field is empty and submit form | |
if (getString == "") { | |
document.getElementById("formAntiSpam").submit(); | |
// if not, sending blocks | |
} else { | |
evt.preventDefault(); | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment