473,408 Members | 2,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

a:hover does not work without href attribute in <a> ?

Is there a reason why this does NOT work in IE6.0 ?

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

It only works when I add the href attribute:

<a href="">Some text</a>

I have already read that the <a> HTML tag is the only tag in IE that
supports the hover. I have created a treeview and all my <a> tags look like
this:

<div>
<a onClick="toggle(this)">Node 1</a>
</div>

In my toggle function I will set the style of the <div> to either
display:none or display:visible, that works. I need to hover of the <a> tag
so that whenever I move my mouse over Node 1 the background color changes.
How can I achieve this?

I am trying to create something similar like the treeview you can find at
http://msdn.microsoft.com/library/default.asp or does anybody know how the
deeptree.css looks like?

TIA

Gabriel Lozano-Morán
Nov 19 '05 #1
2 2833
I have a found a solution by replacing the className of my node with another
class.

Gabriel
Nov 19 '05 #2
Gabrial,
There are actually a couple of ways to complete what you would like to do.
One example follows.

<html>
<head>
<style>
.ImOver
{
text-decoration: none;
}
.ImOff
{
text-decoration: underline;
}
</style>
</head>
<body>
<span onmouseover="this.className='ImOver'"
onmouseout="this.className='ImOff' onClick="Toggle(this)">Some text</span>
</body>
</html>

"Gabriel Lozano-Morán" wrote:
Is there a reason why this does NOT work in IE6.0 ?

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

It only works when I add the href attribute:

<a href="">Some text</a>

I have already read that the <a> HTML tag is the only tag in IE that
supports the hover. I have created a treeview and all my <a> tags look like
this:

<div>
<a onClick="toggle(this)">Node 1</a>
</div>

In my toggle function I will set the style of the <div> to either
display:none or display:visible, that works. I need to hover of the <a> tag
so that whenever I move my mouse over Node 1 the background color changes.
How can I achieve this?

I am trying to create something similar like the treeview you can find at
http://msdn.microsoft.com/library/default.asp or does anybody know how the
deeptree.css looks like?

TIA

Gabriel Lozano-Morán

Nov 19 '05 #3

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

Similar topics

2
by: Gregor Horvath | last post by:
Hi, Before I reinvent the wheel I`d like to ask if someone has done this before since I did not find an advice at Google. The goal is to create a dynamic Tree View in HTML. Say I have a...
6
by: snacktime | last post by:
I've searched and searched and have not found a solution to suppress the margin on form or href tags so that there is no space before or after the tag. The only way I have found to do this is to...
5
by: specjal | last post by:
hi in form TEXTAREA i have text like: bla bla http://www.google.com/bla/bla/bla text text text text now how to make from this text like: bla bla text text text text
13
by: tperri | last post by:
I have an HTML table with several fields like this: <A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood" ImageUrl="images\buttons\btn-food-i.gif"...
1
by: rn5a | last post by:
Consider the following code: <script runat="server"> Sub Page_Load(obj As Object, ea As EventArgs) Dim sqlReader As SqlDataReader sqlReader = 'calling a function that returns SqlDataReader ...
8
by: Larry | last post by:
Hi, I'm trying to get the following working but I'm at a loss and dont know what is wrong with it: <div class="name"> <a href=" <xsl:apply-templates select="key" mode="getValue" /"...
3
by: ajaspersonal | last post by:
"i want to change font_style (hyper link<a href...>text</a>) normal to italics.when load a page" this is my problem but that label included in one 'USERCONTROL' This user controls may...
14
by: Michael | last post by:
Since the include function is called from within a PHP script, why does the included file have to identify itself as a PHP again by enclosing its code in <?php... <?> One would assume that the...
8
by: Prisoner at War | last post by:
Another weekend, another project, another problem.... Why should a perfectly fine function work only half-way through when called through onClick in an anchor tag?? The text fade-in script...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.