Skip to content

Instantly share code, notes, and snippets.

@Avelar
Last active September 1, 2015 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Avelar/c124651134802d41afc7 to your computer and use it in GitHub Desktop.
Save Avelar/c124651134802d41afc7 to your computer and use it in GitHub Desktop.
Reverse Captcha Basic
<!--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