CoderZone.org

Category: >> JavaScript >> Anti_Bot Form Code Bookmark and Share

<< 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)

Author: CoderZone
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>
 
Add a comment 
EdMay 2nd, 2013 12:11pm
Cool idea, and it WORKS!
© coderzone.org | users online: 10