[Javascript] Changing link hover through JS
Paul Novitski
paul at juniperwebcraft.com
Wed Jun 11 08:59:27 CDT 2008
At 6/11/2008 02:31 AM, Rees, Mark wrote:
...
>if you need something (anything) to change colour on mouseover, one
>way is to set a class for it in the CSS, and then apply that class
>using JS in the onmouseover event.
I agree. It's the difference between embedding the colors in your
JavaScript code and separating them out into your stylesheet. For a
superabundance of rationale for separating development layers, google
'separation layers javascript'.
One way to apply different colors to anchors throughout a page would
be to apply incrementally different classes to the anchors which
would be reflected in the stylesheet:
<a class="anchor001" href="...">...</a>
...
<a class="anchor002" href="...">...</a>
...
a.anchor001:hover {color: #336699; }
a.anchor002:hover {color: #6699CC; }
...
If the coloration effect is important to the comprehension of the
page, I'd apply them server-side so they appeared regardless of
whether JavaScript is enabled in the browser. For more on this
subject, google 'progressive enhancement'.
In my view JavaScript cannot competently replace server-side
scripting, it can only enhance.
Regards,
Paul
__________________________
Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com
More information about the Javascript
mailing list