Changing the window.status in onmouseover/onmouseout events

You can can change the text in the status bar by assigning a value to window.status (using JavaScript). This you can do in the onmouseover and onmouseout events of your link to overwrite the default text (URL).
Date Created: 25th October 2006
Date Modified: 25th October 2006
Home > JavaScript > window.status

Query raised in WebmasterWorld HTML Forum:
http://www.webmasterworld.com/html/3130670.htm

<a href="contact.html"
  onmouseover="window.status='Contact'; return true;"
  onmouseout="window.status=''; return true">Test Link</a>
Test Link that should change the message in the status bar

Will show "Contact" in the status bar instead of the URL, and it will clear the text when you move out of the link.

Further enhancements... You could assign these events when the page is loaded, so you don't have to add it to every link manually - you could also extract the filename and capitalise the first letter for example, so you don't have to set it for each link ('contact.html' becomes 'Contact' etc.)

This should work OK in IE. It will work OK in Firefox if the user has not disabled this feature (it is disabled by default though I think). In Opera, you can't seem to change the text in the onmouseover event - it always displays the URL - although it works OK in the onmouseout event. So, in short, you cannot rely on it.

Just some more links... the onmouseover and onmouseout events are added on page load.

Link One | Link Two | Link Three | Link Four

[Home]