Example 6—Scrolling Status Bar Message

Another common JavaScript-powered effect is the scrolling message in the status bar of the browser. It's a great way to pass small amounts of information to the visitor without having to resort to alert boxes. Even though the status bar is small and unobtrusive, it is still effective.

Here is a simple example that places a little information in the status bar when the user moves the mouse over an image hyperlink:

<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
<!-- Cloaking device on!
function addMsg()
{
window.status="Sample image";
return true;
}
// Cloaking device off -->
</script>
</head>
<body>
<a href="moveon.htm" onMouseover="window.status='Sample image'; return true"

Get JavaScript™ 1.5 by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.