JavaScript email link
-
Hello all,
I ran across a way to use javascript to place an email link on a page, rather than an anchor. The reasoning behind this is that crapbots will have a tougher time at harvesting the email address this way. Here’s the script:
<script type='text/javascript'>var a = newArray(' "MAILTO:" in ASCII characters ',' first 7 characters of your address ',' second 7 characters of your address ',' et cetera... ');document.write("<a
href='"+a[0]+a[1]+a[2]+a[3]"'>"+a[0]+a[1]+a[2]+a[3]"</a>");</script>
<noscript><img src=" location of the image of your email address " title=" img title "></noscript>After
Array('
enter your email address seven characters at a time between single quotes, no spaces, separated by a comma. Then, afterhref='
enter +a[0]+a[1]+a[2]… until you’ve entered all the groups required to fit your address. Do the same between the anchor tags for the name, or enter a set of words. The<noscript>
tags are for people who’ve disabled javascript.Now, here’s the question. How do I use javascript in WP? When I placed the code on my “contact” page it didn’t show up. There was just a blank there. Any takers?
~Jonathan
- The topic ‘JavaScript email link’ is closed to new replies.