Hide your Email Address from Spammers with a Simple JavaScript
If the email address is: joe@mydomain.com, most websites use:
<a href="mailto:joe@mydomain.com">joe@mydomain.com</a>
That line of basic HTML is easily harvested by spambots. Within a few weeks, the spam will start trickling in. After a few months, there will be a flood of annoying spam emails.
What can you do? Start with a fresh email address and use this small JavaScript:
<script type="text/javascript"><!--
var name = "joe";
var domain = "mydomain.com";
document.write('<a href=\"mailto:' + name + '@' + domain + '\">');
document.write(name + '@' + domain + '</a>');
// --></script>
Simply replace the email address segments in lines 2 and 3. Then, paste the JavaScript into the HTML code for the page (replacing the mailto code). You are done!











