Monday, February 12, 2007

Add 'hidden' email address using 'Add new element' and Javascript

Here are the instructions for creating the 'Email Me' link at the top of the right sidebar of this page. The email address is hidden from unwanted 'visitors' to your site (e.g. spambots) by javascript.

Instructions

Change the 'text', 'email' and 'emailHost' variables below to suit the email address you want to hide.

<script language="JavaScript" type="text/javascript">
<!--

var text = "Email Me"
var email = "myname"
var emailHost = "gmail.com"

document.write("<a href=" + "mail" + "to:" + email + "@" + emailHost+ ">" + text + "</a>" + ".")
//-->

</script>


If you dont want to use this script of find it hard to do then this tool from htmlfixit will create a script for you. This one will show your actual email address rather than just the 'email me' link though.

1 comment:

  1. Hi Sue,
    Thanks for stopping by my sites, I enjoy the visits.

    I want to also share with you another way of adding the Email Me link, listed on my blog under the creating links label.

    Things are looking great on your blogs. Sherry

    ReplyDelete

I have removed 'nofollow' in appreciation for you taking the time to comment.