JAVA SCRIPT

We are not going to get into the powerful but complicated javascripting language, but there's one simple addition that we think adds a nice touch.

Ever notice how the bottom header bar of your browser usually shows the linked URL when your mouse passes over a link? That bottom header can show a readable message, if you'd like! Here's how:

Within an <A HREF=...> statement, just add:
onmouseover="window.status=´(message)´; return true"

To help make sure you're aware of spaces and punctuation, in words it's:


onmouseover=
quotationmark window period status=
apostrophe your message apostrophe semicolon space
return space true quotationmark


As is always the case, be sure that this element is separated by a space from other elements within the <A HREF=...> tag.

For example, let's look at the link html:
<A HREF="http://www.primeshop.com">See the javascript discussion!</A>
which is a hyperlink to Primeshop, and will show the URL in the bottom header window.
Now, let's add the message, "An easy javascript enhancement!" to the window by adding the javascript code:

<A HREF="http://www.primeshop.com" onmouseover="window.status=´An easy javascript enhancement!´ ; return true">

Finally, let's erase the message when the mouse leaves the link by adding the onmouseout tag:

<A HREF="http://www.primeshop.com" onmouseover="window.status=´An easy javascript enhancement!´ ; return true" onmouseout="window.status=´´ ; return true">


Here's the real thing (with a link to this subject). Pass over them with your mouse pointer, and watch the bottom window message change (c'mon, now...get a late-version browser so you can see it!)
Without javascript: See the javascript discussion!
With javascript: See the javascript discussion!
Pay close attention to the exact use of single and double quotes, and spaces. Note that if your message is to include quotations or apostrophes you'll need to use the HTML3 ASCII symbol codes. There are some problems with Internet Explorer's interpretation of HTML3-coded characters..
FURTHER EXPLANATION:
In the example above, see that both the quotation marks and apostrophes are used within the javascript command. The quotation marks open and close the command, while the apostrophes segregate the intended message. If you were to place an apostrophe or quotation mark within the body of your message, the browser would erroneously interpret that as a part of the Javascript command. For example, if you wanted your message to include quotation marks as in the expression Here is the "Stargazer" page., then you'd enter the included quotation marks with the ASCII symbol code &#34; - not with a typed-in quotation mark.
For any browser, be aware of the semicolons as the last figure in the HTML3 codes - they are not punctuation, they're part of the code!
7/8/98 Another lesson learned the hard way:
The newer browsers, e.g., Netscape Communicator 4.04, will not tolerate even an ASCII symbol value for the single quotation mark - it will be interpreted as part of the javascript command. In such a case, substitute a lookalike. For instance, instead of the single quote (&#39, or ' ), substitute using the #146 symbol, which yields the apostrophe ( ’ ) instead of a single quote.




Back to the web index page