As you may, or may not know, evil spam harvesting bots collect email addresses on web pages. There are a few ways to defend yourself. Unfortunately this is yet another thing to think about.
You can put your email address as an image (non clickable) in the page, you could do something like user [at] domain [dot] com, but both of these solutions to the problem do not allow the end user the ease of getting ahold of you.
You can also only put a form on the site, but this forces someone to use the form (some people would rather use an email client). This is a great way to handle the problem, but your email address is still hard coded into HIDDEN form fields (in most cases). The best solution for this method is using PHP (although PHP is not always available), thus your email address is never in the source code.
There is a way to display your email address using javascript to perform a "document.write" and concatenate parts of code and variables together to make the mailto link. This is by far the slickest solution. There is one glaring problem though. This solution does not comply to usability and accessibility standards. It does not pass Government Section 508, or Bobby guidelines. But if usability or accessibility compliance is not your thing, then this javascript tip sure is slick.
<script language="javascript">
<!--
var contact = " Ken Edwards"
var email = "ken"
var emailHost = "meancode.com"
document.write("<a href=" + "mail" + "to:" + email + "@" + emailHost + ">" + contact + "</a>")
//-->
</script>
This script can be put anywhere in the page, it does not have to be in the head region. If you put it in your head region, you will have to break the script up into two, one for the vars and one for the document.write.







Article comments
1 - gerrard
You can display encoded HTML entities for display purposes:
@
&#64;
2 - Ken Edwards
@ displays in browsers like @, i tried
3 - Ken Edwards
fixed it!