user experience design and consulting
404.520.0003
info@clickstart.net

Single sourcing variables

This demo stores commonly-used information in a JavaScript file. This single-sourced content can then be inserted into any help topic.

The single-sourced content can contain formatted text, images, and links.

How to see the demo

Look at the "author" and "copyright statement" below. The author's name and the copyright information are being single sourced from a JavaScript file.

Author:

Code

from autotext.js
function autotext(entry) {
if (entry == 'author') document.write('Scott DeLoach');
if (entry == 'copyright') document.write('Copyright 2008, ClickStart, Inc.');
}

Author: <script>autotext('author')</script>

How it works

This script uses the onMouseOver and onMouseOut events to show and hide a hidden DIV (the help content). Multiple links can use the same scripts because the ID of the hidden DIV (in this example, "fieldhelp") is sent to the scripts as a variable.

Browser compatibility

This script should work in any browser.

Questions?

Just send us an email.