• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 283
  • Last Modified:

is it possible to implement hyperlink visited functionality using javascript onmouseover function?

is it possible to implement hyperlink Visited functionality of stylesheet using javascript onmouseover function?
1 Solution
What are you attempting to acheive?
coolgemini_99Author Commented:
When the user hovers over(not "On Click") a hyperlink, the hyperlink should follow CSS Stylesheets "Visited" format. So, when the user comes back to that page, that particular hyperlink will show in "Visited" color.
The css class "a:visited" is an example of a CSS pseudo-class. Because it is a pseudo-class, and not an actual class, you can't control it via javascript.

You will have to duplicate the CSS class to another one, give it a specific name, and use that in your javascript instead.


a:link {
      color: #0000FF;
a:visited {
      color: #FF0000;
      font-weight: bold;
.myvisited {
      color: #FF0000;
      font-weight: bold;

<a href="blahblah.htm" onmouseover="this.className = 'myvisited'" onmouseout="this.className = ''">
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now