Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mouse over change color?

Status
Not open for further replies.

juandiegomc

Programmer
Apr 25, 2003
60
US
hello,

I need the snippet of code to change the color from "blue"

to change to red on "mouse over" or "mouse touch", as it

does here on the TEK-TIP labels.

on a command word to open a new page?

juandiegomcc@afirmacion.com
 
What you need is CSS pseudo classes. In IE they only work on links (the <a> tag) but it seems you are looking for that. Here's how you do it:

<style>
a:link, a:visited { color: blue; }
a:hover { color: red; }
</style>

<a href=&quot;uri.html&quot; target=&quot;_blank&quot;>Open in new windows</a>

The problem with this is that all your links will follow this behaviour. So you can define a special class and apply it only to those you want:

<style>
a.classname:link, a.classname:visited { color: blue; }
a.classname:hover { color: red; }
</style>

<a href=&quot;uri.html&quot; target=&quot;_blank&quot; class=&quot;classname&quot;>Open in new windows</a>
 
Thanks Vragabond,

Where should one store this &quot;class&quot;? I am just catching on the CSS.

juan diego mcc

juandiegomcc@afirmacion.com
 
This code should do the job for you:

Code:
<HTML>
<HEAD>
<STYLE TYPE=&quot;text/css&quot;>
a:link		{ color: blue; }
a:visited	{ color: blue; }
a:hover 	{ color: red; }
</STYLE>
</HEAD>
<BODY>

<A HREF=&quot;[URL unfurl="true"]http://www.google.co.uk/&quot;>Click[/URL] here</A> to visit Google UK...
</BODY>
</HTML>

Hope this helps!

Dan
 
Happy New Year BillyRayPreachersSon,

I was only able to get one label to respond to the code and it comes out the wrong color, green since I made green the color of a label 'visited' Could you look at my web site:


and go to the spanish --->>> and then to links.... and you will see the labels .

juandiegomcc@afirmacion.com
 
Hmmm, I did what you asked but there was no css code there. Incidentaly, your buttons do not work in Mozilla 1.4 (as well as browsers which have javascript disabled) - I had to reach the page by manually typing URLs.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top