Home
» Other Stuff » JavaScript hide email address
JavaScript hide email address
| April 23, 2009 | Posted by The Futtock under Other Stuff |
If you want to avoid spam robots crawling your email address, then the following bit of code can help. It breaks up the address, and uses javascript to present it properly to the end user. Just replace your email address with the following, changing id to your name, dom to the site name and tag to the site name tag such as com or net.
<script type=”text/javascript”>
id = “johndoe”;
dom = “example”;
tag = “com”;
document.write(‘<a href=\”mailto:’ + id + ‘@’ + dom + ‘.’ + tag + ‘\”>’);
document.write(id + ‘@’ + dom + ‘.’ + tag + ‘</a>’);
</script>
Recent Comments