473,484 Members | 1,718 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Underlining text, changing colors

How can I change the text in a link, originally displayed with the
"text-decoration:none" attribute to display an underline during the
onMouseOver event, and back to its original (non-underlined) state for
the onMouseOut? I'm pretty sure that it's of the format

document.<itemname>.attribute = value

but beyond that I'm not sure, and I can't find enough of a reference to
let me proceed. I'd also like, as an alternative, to be able to change
the font color instead of (or in addition to) just changing to underlining.

I'd appreciate it very much if anyone can provide a bit of code, or can
point me to some on-line reference that shows this. Thanks!
Henry
Jul 23 '05 #1
6 2358
Henry wrote:
How can I change the text in a link, originally displayed with the
"text-decoration:none" attribute to display an underline during the
onMouseOver event, and back to its original (non-underlined) state for
the onMouseOut?


<style type="text/css">
a:hover {
text-decoration: underline;
}
</style>

Mick
Jul 23 '05 #2

Thanks, Mick, for the speedy reply. I haven't used CSS before (I've had
some minor exposure to them, and I know that I should be using them...)
so I have a couple of questions.

First, does it matter where this snippet is placed on the HTML page? I
tried it in several locations (just inside the BODY and HTML tags, as
well as inside a <Table></TABLE>, but no soap.

Does it matter that the page where I'm trying to implement this is part
of a frameset? I have a links page (the left-most frame) where I want
this to be in effect.

Second- does the page's extension matter? Not only is this page part of
a frameset, it is also a JSP page. (Aha, the truth comes out!) Could
this be a factor, as well?

Certainly these effects are not crucial, but they are, I believe, pretty
understated and can give the page a more polished look. I'd like to get
this working, and appreciate your help.
Henry

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3
Mick White wrote:
a:hover {
text-decoration: underline;
}


But be warned, modern browsers will also display this effect for <a>s
with only a "name" or "id" attribute.

Jul 23 '05 #4
Henry Hayden wrote:
Thanks, Mick, for the speedy reply. I haven't used CSS before (I've had
some minor exposure to them, and I know that I should be using them...)
so I have a couple of questions.

First, does it matter where this snippet is placed on the HTML page? I
tried it in several locations (just inside the BODY and HTML tags, as
well as inside a <Table></TABLE>, but no soap.
Inside <head> tags is preferred.
Does it matter that the page where I'm trying to implement this is part
of a frameset? I have a links page (the left-most frame) where I want
this to be in effect.

Second- does the page's extension matter? Not only is this page part of
a frameset, it is also a JSP page. (Aha, the truth comes out!) Could
this be a factor, as well? This should not matter
Certainly these effects are not crucial, but they are, I believe, pretty
understated and can give the page a more polished look. I'd like to get
this working, and appreciate your help.
Take a look:
http://www.mickweb.com/demo/hover.html

Mick

Henry

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 23 '05 #5
Thanks again!

I found, with the help of your last hint, what the problem was. In each
link, I had the following:

style: text-decoration: none

So... it was always going to be just that... none.
However, using the following:

<style type="text/css">
a{
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
</style>

works just fine. Thanks again!

Henry
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #6
Keith Bowes wrote:
Mick White wrote:
a:hover {
text-decoration: underline;
}


But be warned, modern browsers will also display this effect for <a>s
with only a "name" or "id" attribute.


Which is why you want to use

a:link:hover, a:visited:hover {
...
}

and the like. F'up2 comp.infosystems.www.authoring.stylesheets.
PointedEars
Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3724
by: GujuBoy | last post by:
i have a ansi.py file that i use in LINUX to change the text color to STDOUT when i use the "print" function...but when i move this ansi.py file over the windows...it does not work is there a...
4
3620
by: Nick Calladine | last post by:
I have a table which has a drop down list in cell ; a image in another cell and a description in the third cell when the page is displayed it has a default picture and default text when the...
25
4294
by: madsgormlarsen | last post by:
Hi I am making a tab menu with css, and the tabs changes color depending on wich tab is current. 1. I could load a different css file for each tab/color. 2. I could do some inline css only...
1
1166
by: jhickers | last post by:
In MS 2003 or 2002 can anyone tell me the simplist way to change color of text in a form or report? I want the values of currency fields changed to red if the amount is >= to $1,000. I am not a...
3
1135
by: Vinay | last post by:
Hi All: I'd like to fill a set of controls with colors (by probably setting control.backcolor) that are changing gradually - e.g. start from dark green and endup with lightgreen. How can I do...
0
756
by: mihir.kotwal | last post by:
Code: oWord.ActiveDocument.Range.InsertAfter(defword) oWord.ActiveDocument.Range.InsertAfter(" -" & defdef & vbNewLine) How can I get the defword to be underlined while leaving the rest...
3
1466
by: Manil | last post by:
Hi, I am new to the forum. I wanted to know if there's any way in which I can underline a phrase in a webpage using CSS. I tried using "text-decoration:underline;" but it looks like that works...
8
4399
by: questionit | last post by:
How in a TextBox , lines of text can be displayed, each with different colors ?
0
7082
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6953
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7105
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7144
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7214
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4529
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3041
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
592
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
235
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.