Return to Course Content Home

JavaScript Example #2

Setting a message in the status bar

As you may remember, the "window" object has a status attribute. As an example as to how to set the content of the status bar, see the code below

<html>
<body>
<script type="text/javascript"> function showStatus{
window.status="You pressed the button!";
}
</script>
<p>Status Bar Example. After pressing the button, look at the status bar</p>
<input type=button onclick="showStatus()" value="Click me! />
</body>
</html>



This is a great example of using the status bar, but it is also a great example of browser incompatiblities. The status bar is only supported in Microsoft IE and Opera, but not in Firefox. So if you are running this in firefox...which I am normally...nothing happens!