Quick Search:
 
 JavaScript: Anti-Bot Form Code Jump to:  
Category: >> JavaScript >> Anti-Bot Form Code  

<< lastnext >>

Snippet Name: Anti-Bot Form Code

Description: In this example, the action of the form is not set until the user clicks on submit. I believe this should foil most bots. The javascript can easily be obfuscated to make it even more difficult for a bot to do its dirty work.

Comment: (none)

Language: JAVASCRIPT
Highlight Mode: JAVASCRIPT
Last Modified: February 27th, 2009

<html>
<head>
<script type="text/javascript">
     FUNCTION submit1(){
     VAR o=document.getElementById("form1");
     o.action="test.asp";
     o.submit();
}
</script>
</head>
<body>
<form id=form1>
<table>
<tr><td>First Name:</td><td><input name=fname></td></tr>
<tr><td>Last Name:</td><td><input name=lname></td></tr>
<tr><td>Email Address:</td><td><input name=email></td></tr>
</table>
</form>
<input type=button onclick="submit1();" value=Submit>
</body>
</html>


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org