JavaScript Email Database
Ease the pain of updating mailto: links.

Oh no!

OK, you are the webmaster for a site with hundreds (or merely dozens) of web pages on your website or intranet. You started with a template that contains an email link so that people can contact you, and as you built your site you diligently used your template. As time went on you added email links for several dozen other people scattered over many pages. You have those hard coded into a lot of HTML files, and someone just changed ISPs. Now what do you do?

Well … This is a simple text substitution of "this" for "that" and your HTML editor can handle this sort of global change in all of your files. It wouldn't take long to update the pages for one address, but changing "n" addresses could take "n" passes, and uploading dozens of pages could take a good part of your weekend — unless you go searching for an ftp program that will upload them in a single batch.

A Better Solution

Programmers know that you should put common code in one single place. If you don't, you could scatter the same bug all through the system, and upgrades could take forever. The same principles hold in web design: modularize and localize. If you can put all of the email address links in one place, all you have to do is make one edit and one upload. Here is a way to do it using JavaScript with a simple database and a single function called makeAddr(). Using this function the HTML coding is simple, and no mailto: or @ sign appears in the raw HTML files for spambots to harvest.

On the left is the JavaScript that calls makeAddr() to create the email links in the table on the right. Put your mouse pointer over the links and see the URLs in the status bar of your browser.
(But please don't use them to actually send email. Tom, Dick and Mary's are fictitious. :-))

The Code

<script type="text/javascript">
  preextra = "<BR>";
  // -->
<script type="text/javascript">
  preextra = "";
  preextra = "<BR>";
  makeAddr("Mary Contrary");
  makeAddr("Your Name");
  // -->

The Result

Links Using Numerical Indices Links Using Named Indices

Feel free to download a sample database and the makeAddr() JavaScript source code. It is heavily commented so even if you are not a JavaScript programmer, it should be clear how to use it on your web site. Permission is granted to use this JavaScript Email code provided the copyright notice is retained.

If you use it please give us about how you like it.

We have an even better version that doesn't write the email link until the user clicks on it.

If you need help designing and implementing your JavaScript software applications or web design, call Design Matrix at (310) 455 3107 or

Joint projects with other software and web designers are welcome.