[thelist] Using JavaScript for non-clickable email addresses

Robert Vreeland vreeland at studioframework.com
Tue Jan 25 19:41:47 CST 2005


I have used this routine in the past.
1) make your anchor a named anchor with no href.
2) break up the email address into parts wrapped in span tags.
3) use an onmouseup event to generate a mailto href. I usually include the
JavaScript function in an external file.
I have tested following is example code in IE and Firefox and used similar
code in Netscape 6+. While I haven't tested it with a text reader, I don't
think it would cause any problems. The email address is legible in
non-JavaScript enabled browsers.

<script type="text/javascript">
function hello(){
 linkArray = "";
 if(arguments[0].nodeName == ("A" || "a")){
  linkArray = "mailto:";
  linkArray = linkArray + arguments[0].firstChild.innerHTML;
  linkArray = linkArray + "@";
  linkArray = linkArray +
arguments[0].firstChild.nextSibling.nextSibling.innerHTML;
  arguments[0].href = linkArray;
 }

}
</script>

<a name="anchor1"
onmouseup="hello(this)"><span>vreeland</span><span>&#064;</span><span>studio
framework.com</span></a>


Robert Vreeland
Managing Partner
StudioFramework
----- Original Message ----- 
From: "Jono" <ox4dboy at comcast.net>
To: "thelist lists.evolt.org" <thelist at lists.evolt.org>
Sent: Tuesday, January 25, 2005 4:10 PM
Subject: [thelist] Using JavaScript for non-clickable email addresses


> I would like to place an email address on a page, but I do not want
> SPAM Harvesters to see the address.  I have a solution to display
> useable/clickable email addresses, but I need to find a solution to
> display an email address that is not clickable as well.
>
> I do not want to just type <p>person at domain.com</p> b/c there are
> harvesters that easily pick it up.  So, what I need is a complex
> (javascript) solution to something very simple...unfortunately.
>
> I know that there is no safe approach to this, b/c harvesters are
> always evolving, and I cannot currently do the email protection server
> side.  It is heading that way, but will not get done for a few months.
>
> So, is there a simple js snip that will produce plan text?
>
> Something along the lines of what is on this page...
> http://www.bronze-age.com/nospam/
>
> ...only plain text needs to be produced in place of a functioning email
> address.
>
> Any one have an idea?
>
> -- 
>
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !



More information about the thelist mailing list