Skip to content

Instantly share code, notes, and snippets.

@taspts

taspts/AntiSpamEM

Created Jun 2, 2015
Embed
What would you like to do?
Javascript Anti Spam Email
<!-- Hiding email address using a function to write in document (DOM) -->
<script type="text/javascript">
//<![CDATA[
function AntiSpamEM(domain, id, name) {
email='"mail' + 'to:' +id + '@' + domain.replace(/%23/g,".") + '"'
return '<a href=' + email + 'onmouseover=' + email + 'onfocus=' + email + '>' + name + '</a>' ;
};
//]]>
</script>
<!-- Write Email link in DOM using function -->
<script type="text/javascript">
//<![CDATA[
document.write(AntiSpamEM('xxx%23yyyy%23org','xyz','contact'));
//]]>
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.