Forum Moderators: open

Message Too Old, No Replies

Changing status bar message on link mouseover.

...but without using the 'onmouseover="..."' attribute in the html

         

bedlam

6:56 pm on Mar 1, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Greetings,

Obviously the fallback solution to this problem is simple, but I would prefer not to add any onmouseover attributes to the markup.

I've tried to make it work as shown below (reduced test case), but it won't work. Suggestions much appreciated.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Mouseover Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javaScript">
function stat_write(yourtext) {
window.status=yourtext;
}
function windowStatus() {
window.status = "test!";
}
function statusBar() {
document.getElementById('testId').onmouseover = windowStatus;
}
window.onload = statusBar;
</script>
</head>
<body>
<a href="http://someplace.com" id="testId">Test Link</a>
</body>
</html>

I've used this method for image rollovers, changing link properties etc very successfully. I have no idea why this doesn't work.

-b

Fotiman

7:42 pm on Mar 1, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Your windowStatus function needs to return true.

function windowStatus() {
window.status = "test!";
return true;
}

Fotiman

7:43 pm on Mar 1, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You will probably want to also add an onmouseout to clear the status. :)

bedlam

8:12 pm on Mar 1, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Darn. I knew it would be something simple--simple like me ;-)

Thanks

-b