Jump to content

mouse over function


prc

Recommended Posts

I'm trying to make a function from the mouse over script to display messages in the status bar. I got it working with the following script:

<a href="#" onmouseover="window.status='Home';return true;" onmouseout="window.status='';return true;">Home</a>

but now that I have a few of these for my navigation I was wondering if this could be done by calling it by a function. Is this possible in this case? Here is my code at the moment:

<html> <head> <script type="text/javascript"> function roll(txt) {window.status=''+txt+'';return true;}</script> </head> <body> <a href="#" onmouseover="roll('Home')" onmouseout="roll('')">Home</a></body> </html>

any help would be greatly appreciated. prc

Link to comment
Share on other sites

Here's one i made earlier :)

<html><head><script>function showStatus(sMsg){    window.status = sMsg;    return true ;}</script></head><body><a href="http://www.google.com" onMouseOver="return showStatus('Hi Google');" onMouseOut="return showStatus('');">Google</a><br /><a href="http://www.yahoo.com" onMouseOver="return showStatus('Hi Yahoo');" onMouseOut="return showStatus('');">Yahoo</a><br /><a href="http://www.ebay.com" onMouseOver="return showStatus('Hi Ebay');" onMouseOut="return showStatus('');">Ebay</a></body></html>

Link to comment
Share on other sites

Some browsers don't support window.status, and in FireFox, you have to enable it as an option in the settings section. But this should work in IE:

<html><head><script type="text/javascript">function roll(txt){window.status=txt;}</script></head><body><a href="#" onmouseover="roll('Home')" onmouseout="roll('')">Home</a></body></html>

:)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...