Change style VISITED attribute inside div table

I need to change the text html link to underline, change text link color, and hover color when the page has been VISITED. I don't want to do this with CSS but with the style= statement inside a DIV directly in the html code on the page:

I prefer to use a table instead of CSS so I need the code inside the div.  This should only be for this one line, inside the div. I would also like to change the color of the link when it's been visited to something other than the default vlink on the page. For my purposes, white would be best for vlink. I know there are better ways to do this, but I'd prefer this way if possible.


<td>
<div style="what goes here?">
<a href="link-this-line">Ths text</a> should be underlined only when the page has been visited.
</div>
</td>

Open in new window

JanrowAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

b0lsc0ttIT ManagerCommented:
Janrow,

The problem with not using CSS is Javascript doesn't know if the link was visited.  Javascript could do the change when the link is clicked, hovered and other events but it doesn't know if it was visited.  If visited is what you want you will need to stick with CSS.

CSS can change just that single line though.  Place the line in a span tag and assign a unique ID to the span or put the style tag in that span.  Let me know if you need help with the specifics of the style.

Let me know if you have any questions or need more information.

b0lsc0tt
0
prunckleCommented:
Janrow,

Your best bet is to define the CSS in a seperate class in the head of the document, like:
<head>
<style type="text/css">
a.visund:link {
	text-decoration: none;
         color: #0000FF;
}
a.visund:visited {
	text-decoration: underline;
	color: #FFFFFF;
}
a.visund:hover {
	text-decoration: none;
	color: #0000FF;
}
a.visund:active {
	text-decoration: none;
	color: #FF0000;
</style>
</head>
 
<body>
<table>
<tr>
<td>
<div>
<a href="your URL" class="visund">Ths text</a> should be underlined only when the page has been visited.
</div>
</td>
</tr>
</table>
</body>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
prunckleCommented:
Janrow,

I know it's not exactly what you're looking for, but defining it as a seprate class won't effect your other tags, and you can reuse it in the document later if you want to.

I hope it is of some help.

Let me know if I can help a bit further.
0
JanrowAuthor Commented:
Okay, I see what you mean. I searched for a couple hours to solve this.  You solved it in just mnutes. Perfect. I'll sleep tonight.

Thank you!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.