I'm a hack, but a pretty good one... as hacks go, that is...



« (TrayColor - HTML Color Utility) // (home) // (Internet Explorer 7 Favicon Display Problem) »

Spam-Free E-Mail Links Using Javascript

by: havascript.com admin // March 17, 2007   ( ) {

It’s always handy to add an e-mail link as a convenient means by which visitors can make contact with a webmaster, but with the ever increasing scurge of spambots it’s wise to consider alternative ways to accomplish this. One way is by using Javascript using the following code:

<script language=”Javascript” type=”text/javascript”>
function nospam(name,domain) {
  thisLocation = “mailto:” + name + “@” + domain;
  document.location = thisLocation;

Basic link:
<a href=”javascript:nospam(’name-here’,'domain-here.com’)”>e-mail</a>

These variables need to be defined in the link code:
‘name-here’ - the portion of your e-mail address before the “@”
‘domain-here.com’ - the portion of your e-mail address after the “@”

Advanced link:
<a href=”javascript:nospam(’name-here’,'domain-here.com?subject=’)” title=”" onMouseover=”window.status=’ ‘;return true” onMouseout=”window.status=’ ‘;return true”>e-mail</a>

topics: Javascript //


You must be logged in to post a comment.