Solved

Changing a link to visited

Posted on 2003-10-26
4
180 Views
Last Modified: 2013-12-25
Is there a way in Javascript to change a link to visited?  I have the following style:
a.external:visited {
      text-decoration:none;
      color:ffffff;
      font-weight:bold
}
a.external:active {
      text-decoration:none;
      color:ffff00;
      font-weight:bold
}
a.external:link {
      text-decoration:none;
      color:ffffff;
      font-weight:bold
}

to have the active link in yellow, with all others (in this class) in white.  This part works correctly.

Now I want one link to start as yellow then behave as the external class does above.

It seems easiest to be able to "click" that link onLoad to make it visited.

Anyone have any ideas or a different solution?

Thanks!
0
Comment
Question by:kkbenj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 17

Expert Comment

by:dorward
ID: 9771500
You can not change the visited state of a link with JavaScript.

You could do something like:

<a href="whatever" class="yellow" onmousedown="this.class='external';" onkeydown="this.class='external';">

although I'm not entirely clear what you want to achieve or why.
0
 
LVL 25

Accepted Solution

by:
Rouchie earned 500 total points
ID: 9893783
If you want the link text to stay as VISITED, you can alter the order in which you declare the styles.  Link styles are declared in reverse-order of importance, so the last option always take priority over the previous one etc.

I'm not entirely sure what you're trying to achieve, but try this, then post some more details if required;

a.external:active {
     text-decoration:none;
     color:ffff00;
     font-weight:bold
}
a.external:link {
     text-decoration:none;
     color:ffffff;
     font-weight:bold
}
a.external:visited {
     text-decoration:none;
     color:ffffff;
     font-weight:bold
}

If you need to use the :hover class, also use this before the :visited one.
0
 
LVL 8

Expert Comment

by:CoolATIGuy
ID: 10379150
kkbenj,

Please deal with this old thread...


CoolATIGuy
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question