Build a website with javascript games and other dynamic content

Step Three - Change statusbar on mouse events

Please point (no need to click) to the following link to nowhere
When you point at it you will not see a URL in the status bar as usual, but you will see a explaination of the link. When you leave the link the statusbar does not change back to the normal either, but will display another message. It was defined on the link what script would be called if the mouse would move over the link and what script would be called when the mouse moves away from the link.

<a href="step3.htm"

onmouseover="write_in_statusbar('Link to nowhere');

 return true"

onmouseout="write_in_statusbar('Not on the link');

 return true">link to nowhere<'/a>

As you can see in both cases the same script is called. The difference is that the function is called with a different value.

<script>

function write_in_statusbar(statusbartext)

{

window.status=statusbartext;

}

</script>



So in the script the variable statusbartext would hold the value that was passed on from the call of the function. It is then assign to the status of the browser window which is displayed to the user in the statusbar.

Please note also that there is not only the call of the function in the definition of the action on the mouseover event. After the call of write_in_statusbar() is another javascript command that was seperatetd with an semicolon. The "return true" returns a value to the browser so that it knows that it does not need to update the status afterwards. Otherwise the browser would show immediatly after the again the normal status with the URL.

Next step

 

AK
Start

My Games

Get Games

Build Games
space
1 - simple javascripts
2 - change form values
3 - statusbar & mouse
4 - change images
5 - preload images
6 - change location
7 - open/close windows
8 - other sources

Feedback or Questions

about me

 
 

Copyright by Armin Kielack 1998 last modified: