Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: onFocus-style

  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    Netherlands
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    onFocus-style

    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
    *** Don't eat yellow snow ***

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Netherlands
    Posts
    217
    Thanks
    0
    Thanked 0 Times in 0 Posts
    A:focus {COLOR: blue; TEXT-DECORATION: none}

  • #3
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    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>

  • #4
    New Coder
    Join Date
    Jun 2002
    Location
    Netherlands
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I'll have a go with that

    Thanks, I'll have a go with that script......

    MrPink
    *** Don't eat yellow snow ***


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •