"Fast Info" Demonstration
This "Fast Info" method is both simple and fast.
You can use it to present definitions, navigation help, and detailed information
of an otherwise general concept. You will be able to think of other information
you visitors might want quickly.
The "Fast Info" method uses browsers' built-in JavaScript alert box to present
your information.
That method is faster than creating pop-up boxes who's contents must be read from a
file. However, it does have its limitations. Click
for details.
The link in the above paragraph is a demonstration of the "Fast Info" method, describing
its primary limitation. An additional limitation is that browsers must be JavaScript
enabled for the links to work. Without JavaScript, the links do nothing.
Use the following table to view different message sizes:
When you have a sense of appropriate message size, you are ready to
implement the "Fast Info" system on your own pages.
You may use your browser's "view source" feature to see
the JavaScript and HTML code used on this page.
(Note: Some browsers
make assumptions and do not show exactly what the source code looks
like, eliminating unused scripts and/or preferring to show the
characters rather than the code representing it -- "<" rather
than the "<" that may be the actual source. If you
suspect your browser makes such assumptions, use Master Snooper found at
/master/snooper/)
Implementing the "Fast Info" method is a simple two steps.
- Place the link.
- Place the alert box.
To demonstrate those two steps, we'll use an example. The example assumes
you have the following somewhere on your page:
Thus, we use written words.
and you want to link "written word" to an alert box with
the definition of a written word.
The link and alert box need a common yet unique name. Let's call it
defword. With defword as the name, this is how you place
the link:
Thus, we use <a
href="Javascript:defword()">
written word</a>s.
That places the link into your page.
Now, lets place the alert box.
The way to place the alert box is to put a JavaScript function between the
<head> and </head> tags. (Assuming the link and alert box name
to be defword)
<script><!--
function defword() {
var s = '' +
'';
alert(s);
}
//-->
</script>
Notice there is a blank line, between the var s = ' ' +
line and the ' '; line. That is where the message will go; in this
case, the definition of "written word".
Replace that blank line with your message. Once done, put an apostrophe
(single quote) at the beginning of each typed line. Then put an apostrophe-space-plus
sequence of characters at the end of each typed line.
It will look something like this:
'A string of characters ' +
'whose sequence holds a ' +
'significance for the ' +
'viewer.' +
The above will all string together as one paragraph when the alert
box is shown. If you want to force a line break, use the characters:
\n
If you want a blank line between paragraphs, use the above set of characters twice.
(NOTE: Very important! If you need to use an apostrophe (single
quote) within the alert box message, put a left-slash right in front of it.
Otherwise, the browser will get confused with beginning/ending of lines and
will generate a JavaScript error. Thus, you might have a line like:
'I noticed it\'s glow!' +
with a left-slash preceding the apostrophe in the message.)
So, using our word definition example, the final alert box code looks like this:
<script><!--
function defword() {
var s = '' +
'A string of characters ' +
'whose sequence holds a ' +
'significance for the ' +
'viewer.' +
'';
alert(s);
}
//-->
</script>
And this is the result:
Thus, we use
written words.
Will Bontrager
©2000 Bontrager Connection, LLC
Please note:
Articles on this website are presented "as is". However -
If you have a question about a CGI script, HTML, CSS, PHP, or JavaScript
Ask one of our Experts and you'll have your answer!
Click here for details.