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 7 of 7
  1. #1
    Banned
    Join Date
    Mar 2003
    Posts
    224
    Thanks
    0
    Thanked 0 Times in 0 Posts

    stop link-over getting stuck + onclick style

    Hi, I noticed that if you go through my links really really really fast, some of them get stuck. Is there anyway to stop this?

    Also, How can I make an onclick style?



    A:click {

    }

    A:Hover {

    }

    A:link, A:visited, A:active {

    }


    or something like that?


    or, if all else fails:

    <A href="URL" onclick="style('hover')" or something.

    Thanks all

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can make an onclick style with the focus pseudo-class:

    a:focus { ... styles ... }

    But it won't work in IE. An x-browser method would involve mousedown/mouseup:

    onmousedown='"this.style.color='red'" onmouseup="this.style.color='blue'"


    I don't understand your first question ... the links get "stuck" ??
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #3
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    The hover impelemntations aren't entirely reliable - especially not mozilla's, since mozilla has hover on all elements.

    Anyway, sometimes the browsers miss throwing a mouseover or mouseout event, and because of that hovers doesn't trigger or element doesn't restore to normal after a hover.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #4
    Banned
    Join Date
    Mar 2003
    Posts
    224
    Thanks
    0
    Thanked 0 Times in 0 Posts
    how can I apply that to all links?

    <A href="someplace" onmouseover="class='linkhover'" onmousedown="etc etc.

    then apply it to all links:


    onload = function() {
    a_tags=document.getElementsByTagName('a')
    for (i=0;i<a_tags.length;i++) {
    a_tags[i] + onmousedown stuff
    }
    }

    something like that

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yeah you could do that, but it'd be more efficient to do a generic document.onmousedown - you could read back the event target|srcElement and apply the necessary behavior to A elements. That way, you'd have a reusable function you can use to apply mousedown/up changes to any other element.

    But ... well if it were me I wouldn't do it like that either. I'd use the :focus pseudo-class - which will cover all the modern browsers except IE - and then use a DHTML behavior for IE [more?]
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #6
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    a:active is the equivalent of the onmousedown style that you came up with. usually, the only time a link becomes active, is when you click on it.
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #7
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by joh6nn
    a:active is the equivalent of the onmousedown style that you came up with. usually, the only time a link becomes active, is when you click on it.
    Yeah you're quite right - I was thinking because in moz :focus happens when you click down, but is reset when you mouseup; now I come to think of it though, that's a bug, that may well be fixed by now.

    sorry for any confusion.
    Last edited by brothercake; 04-01-2003 at 09:03 PM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark


  •  

    Posting Permissions

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