View Full Version : onFocus-style

10-27-2002, 01: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;



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

Mr J
10-27-2002, 05: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
// -->

<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>

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


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum