Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

verifyRequired and vairables

Status
Not open for further replies.

cjh088

Technical User
Jan 20, 2009
1
CA
Hi, im a n00b at javascript. I am trying to create a simple test to make sure the user is human and not a bot.

so what i did was
<script language=javascript>
var check
var check2
check= (Math.random());
check2= (Math.round(check*100000));
document.write(check2);
</script>

I then created a verifyRequired script

<script language=javascript>
function verifyRequired(){
if (document.formcheck.security !=check){
alert("The security key entered is invalid")
return false;
}
return true;
}


My problem is that the verify function does not appear to beable to check the random number generated each time the page loads, any ideas on a possible work around.
 
Hi

Please note that bots usually not execute JavaScript code. Even more, many of them does not request the once visited [tt]form[/tt] again, only submit again and again. ( So if your [tt]form[/tt] is already known by such bots, they will never notice that you modified your page. ) Your "verification" will only annoy humans.

So do as Greg suggested. ( But avoid other JavaScript based messing like Internet Captcha. ) Or try jpadie's solution.


Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top