...

View Full Version : onFocus-style



MrPink
10-27-2002, 12:00 PM
Hi there,

For my menu-links (in right frame) I'm using this style:

A:link {COLOR: black; TEXT-DECORATION: none}
A:visited {COLOR: black; TEXT-DECORATION: none}
A:hover {COLOR: red; TEXT-DECORATION: none}
A:active {COLOR: blue; TEXT-DECORATION: none}

But when another link (in another frame)is clicked, the active link turns black again. But I need it to stay blue! Something like the javascript-function onFocus does!

Any suggestions? Javascript or CSS, either way is ok...
I need somethink like this:

onMouseOver: font-color=red;
onMouseOut: fontcolor=black;
onFocus: fontcolor=blue;

T.I.A.

MrPink

Bosko
10-27-2002, 12:33 PM
A:focus {COLOR: blue; TEXT-DECORATION: none}

Mr J
10-27-2002, 04:40 PM
Is this any good for you


<script language="JavaScript">
<!--
LastID = ""
function on(id){
(LastID != id?document.all[id].style.color = "red":""); //onmouseover colour
}

function off(id){
(LastID != id?document.all[id].style.color = "black":""); // onmouseout colour
}

function active(id){
document.all[id].style.color = "blue"; // onclick

if (LastID != id){
(LastID != ""?document.all[LastID].style.color = "":""); // colour back to default

}
LastID = id
}
// -->
</script>

<a class="link" id="foura" href="#null" onMouseOver="on('foura','#ff0000','');" onMouseOut="off('foura')" onClick="active('foura')">Link 1</a>
<P><a class="link" id="fourb" href="#null" onMouseOver="on('fourb');" onMouseOut="off('fourb')" onClick="active('fourb')">Link 2</a>
<P><a class="link" id="fourc" href="#null" onMouseOver="on('fourc');" onMouseOut="off('fourc')" onClick="active('fourc')">Link 3</a>

MrPink
10-27-2002, 04:58 PM
Thanks, I'll have a go with that script......

MrPink



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum