Created
June 2, 2015 15:18
-
-
Save taspts/06f833f4cc4cfe069eaf to your computer and use it in GitHub Desktop.
Javascript Anti Spam Email
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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