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