?
Solved

Changing a link to visited

Posted on 2003-10-26
4
Medium Priority
?
183 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 2000 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

WordPress Tutorial 3: Plugins, Themes, and Widgets

The three most common changes you will make to your website involve the look (themes), the functionality (plugins), and modular elements (widgets).

In this article we will briefly define each again, and give you directions on how to install them.

Question has a verified solution.

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

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
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses
Course of the Month7 days, 23 hours left to enroll

765 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