...

View Full Version : stop link-over getting stuck + onclick style



mattover-matter
04-01-2003, 04:38 PM
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

brothercake
04-01-2003, 05:13 PM
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" ??

liorean
04-01-2003, 05:29 PM
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.

mattover-matter
04-01-2003, 07:11 PM
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 :D

brothercake
04-01-2003, 07:32 PM
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?]

joh6nn
04-01-2003, 07:45 PM
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.

brothercake
04-01-2003, 07:51 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum