Obscuring email addresses from spammers
Here’s how to use an image and a .js script to disguise your email address from spam bot email collectors. This method splits the email address server side.
(1) Make an image of the email address you wish to use in .jpg, .gif or .png form.
(2) Creat a .js script as follows*:
var sb_domain = "yourdomain.com"
var sb_user = “whatever”
var sb_recipient = sb_user + “@” + sb_domain
var image = “<img alt=’Contact Me’ xsrc=’images/e.png’ height=’11′ width=’166′ style=’margin-top:2px;border:0′ />”
var sb_url = “mailto:” + sb_recipient
document.write(image.link(sb_url));
If you want to include a subject, use this code:
var sb_domain = "yourdomain.com"
var sb_user = “whatever”
var subject = “Whatever you like”
var sb_recipient = sb_user + “@” + sb_domain
var image = “<img alt=’Contact Me’ xsrc=’images/e.png’ height=’13′ width=’187′ style=’vertical-align:bottom;border:0′ />”
var sb_url = “mailto:” + sb_recipient + “?subject=” + escape(subject)
document.write(image.link(sb_url));
* The ‘/’ at the end of the image is for XHTML - if you are using HTML doctypes, leave it out.
(3) Save the file as whateveryoulike.js in your js includes directory or wherever you wish.
(4) Link to your .js script in the body of the page where you want it to appear as follows:
<script language="JavaScript" xsrc="directorywhereyousavedthescript/whateveryoulike.js" mce_src="directorywhereyousavedthescript/whateveryoulike.js" type="text/javascript"></script><noscript>Email Me</noscript>
Good luck in thwarting spammers!
