[Javascript] Maintaining state

Roger Roelofs rer at datacompusa.com
Sat Oct 6 12:29:01 CDT 2007


tedd wrote:
> Let's say there are three images on a web page such that when the 
> user moves his/her cursor over one image, a border appears. No 
> problem, I can do that with css.
>
> However, I would like the border to remain (i.e., maintain state) 
> after the user has moved the cursor off the image and stay that way 
> until another image is subject to a rollover -- and then, that image 
> would maintain state. Only one image maintains state.
>   
Then you can't use a css hover pseudo-class.  Your best bet is to set
the class attribute on mouseover and remove the class from the others of
the group at that time.

If you post the code you are currently using (or better yet, a url to a
test page), we can suggest how to extend it.





More information about the Javascript mailing list