[thelist] javascipt and css hover

Duncan O'Neill dbaxo at ihug.co.nz
Mon May 13 16:07:01 CDT 2002


> hey all.
>
> quick question.
>
> I'm in need of a pre-written javascript that assigns a value to a css link
> state. ummm that might not make sense... clicking on link "foo" should
take
> the user to the appropriate page and have a visual state that shows the
user
> where they are. so "foo" would be bold and red when the page is foo.html
but
> go to its visited state when "foo2" is clicked. I've seen this for image
> rollovers is it possible with css?
>
> bah...mondays ...here is my css
>
Adam,

normally you would be able to do this with css by adding a class for
the page the visitor is currently on.

e.g.
in the HTML:
<a href="one.html" class="on">page one</a>
<a href="two.html">page two</a>

& in the CSS;
a.on:link  {font-weight:bold
                color:#f00;
}

Using javascript you could try this; write a class in the CSS as above.
Then find out which link in the document.links array you want to
change, and do it in the head of the document like so;

document.links[x].className = 'on';

I've used the className property to dynamically style sections before,
but not sure whether this will work with SSIs.

hth,

Duncan O'Neill
=============================================








More information about the thelist mailing list