In your HTML code, write your e-mail addresses as follows:
me [at] mydomain [dot] com
Here's the JavaScript:
function decodeEmails () {
if (document.getElementsByTagName) {
var spans = document.getElementsByTagName("span");
for (var n = 0; n < spans.length; n++) {
if (spans[n].className == "encoded-email") {
var email = spans[n].firstChild.nodeValue.replace(" [at] ", "@");
email = email.replace(" [dot] ", ".");
var hyperlink = document.createElement("a");
var linkText = document.createTextNode(email);
hyperlink.href = "mailto:" + email;
hyperlink.title = "Send me an e-mail";
hyperlink.appendChild(linkText);
spans[n].replaceChild(hyperlink, spans[n].firstChild);
linkText = null;
hyperlink = null;
}
}
}
}
Just call the decodeEmails() function using your favorite window load event handler.