PDA

View Full Version : change the status bar, when hovering over a link


vkidv
09-24-2002, 08:03 PM
i know this is easy to do..just use the
onmouseover="status= <thing> "

but what if i want to have lots of these?
i think i'd need a script with a function to define each one actualy on the link..like:


// define all link status infomation... is this a good idea ?

var code="Coding Forums, A great place to go if you need help or want to help";
var nullv=" ";


function onoffv(on,off) {
window.status=on
window.status=off
}


//later on in the page..
<a href="http://www.codingforums.com/" onMouseOver=onoffv(code,code)" onMouseOut="onoffv(nullv,nullv)"> Coding Forums</a>


thats just what i think it it will be ( i wrote that how i think it is )

editfixed mistakes

Catman
09-24-2002, 08:12 PM
I'd set up an array of text strings and then used something like this:


onmouseover="window.status=sBarText[0]; return true;"


At least for me, that's a little easier to wrap the mind around.

lpok
09-24-2002, 08:25 PM
You can save your messages in a variable then just access it in the document. Something like thisl


<html>
<head>
<script>
function on() {
window.status="hello";
}

function off() {
window.status="";
}
</script>
</head>
<body>
<a href="1.html" onMouseOver="on();return true;" onmouseout="off()">link1</a>
<a href="2.html" onMouseOver="on();return true;" onmouseout="off()">link2</a>
<a href="3.html" onMouseOver="on();return true;" onmouseout="off()">link3</a>
<a href="4.html" onMouseOver="on();return true;" onmouseout="off()">link4</a>

</body>
</html>

Graeme Hackston
09-25-2002, 03:42 AM
This is an in the page version

function Status(message) {
window.status=message; return true
}


<a href="1.html" onmouseover="return Status('hello')" onmouseout="return Status('')">link</a>

adios
09-25-2002, 03:56 AM
<html>
<head>
<title>untitled</title>
<script type="text/javascript" language="javascript">

var stat = {
a1: 'This is link 1' ,
a2: 'This is link 2' ,
a3: 'This is link 3'
}

function registerMOs() {
for (link_id in stat) {
document.getElementById(link_id).onmouseover = new Function
('status = "' + stat[link_id] + '"; return true;');
document.getElementById(link_id).onmouseout = new Function
('status = ""; return true;');
}
}

onload = registerMOs;

</script>
</head>
<body>
<a id="a1" href="javascript:;">link 1</a><br>
<a id="a2" href="javascript:;">link 2</a><br>
<a id="a3" href="javascript:;">link 3</a><br>
</body>
</html>