Javascript Email Year Scrambler
This javascript snippet is designed to put the year into an email address such as name2007@yourdomain.com so that you can setup a forward at that address each year sending to a real email inbox. That way, if the spammers do get ahold of it you can turn it off at the end of the year and move on to name2008@yourdomain.com. Of course you must remember each year to setup this email forward inbox to send to your valued and SPAM FREE email address. Live example of this on our contact page and below.
Javascript Genterated email address:
Source code:
<script language="JavaScript" type="text/JavaScript">
//js email year scrambler by Michael Hazzard http://miramardesign.com , http://michaelhazzard.com
var currentYear = new Date();
var year = currentYear.getFullYear();
//function getAddress() //if you prefer to use a function method uncomment
//{ //and call onLoad="getAddress()" in the body tag
var teammember=new Array("info","webmaster"); //put name into array to confuse bots and make extensible
var arroba = '@'; // put at sign in var to throw off bots
var site = location.hostname; //pull domain dynamically to further confuse bots;
var site = site.replace(/www./gi, ""); //remove www. in safari or other browsers that might return www.domain.com for location.hostname
var subject = '?subject=Contact%20from%20' + site;
//document.getElementById('address').innerHTML = "<a href=" + "mail" + "to:" + teammember[0] + year + arroba + site + subject + ">Click Here </a>" //for function method also need a <div id="address"> </div> in body
document.write("<a href=" + "mail" + "to:" + teammember[0] + year + arroba + site + subject + ">Click Here</a>");
//} end function if using function method remember to put a div in body w/ id=address
</script>
Usage: paste the script tag into the body of your html doc and change the teammember to the desired name (it defaults to info) then setup an email forward from that name to your permanent email.
Previous page: Js vs PHP: Dates
Next page: Laptop Checkin Beta Test

