Links

V

Vito Dolce LaPesca

Greets,
I have a listing of names:

Bill
Ann
Joe

When the user mouses over each name they turn a different color - using
CSS - not javascript.

like:

a:hover{color:#fff000;

}

and the .html markup is:

<a href="#">Bill</a>

The problem is that the pound sign loads the page to the top. Is there a
way to keep the <a href> and have the user click on the link which keeps the
page exactly where it is and not go to the top?

Thank you.
TR
 
J

Jukka K. Korpela

Vito Dolce LaPesca said:
When the user mouses over each name they turn a different color -
using CSS - not javascript.

This must be a game. How great a game do you plan to create in HTML and
CSS alone?
and the .html markup is:

<a href="#">Bill</a>

The problem is that the pound sign loads the page to the top.

"Pound sign"? Oh well. Anyway, the meaning of the construct you have
written is a link to the start of the document. If you didn't mean
that, why did you write it?
Is
there a way to keep the <a href> and have the user click on the
link which keeps the page exactly where it is and not go to the
top?

Why does the mystic user click on the name? Because you made it a link,
and it looks like a link. So either stop doing that, or make it a real
link.

If you really really want to the play the odd game, make each "link"
point to itself:
<a name="bill" href="#bill">Bill</a>
 
S

Sid Ismail

On Mon, 23 Feb 2004 17:14:34 +0000 (UTC), "Jukka K. Korpela"

: If you really really want to the play the odd game, make each "link"
: point to itself:
: <a name="bill" href="#bill">Bill</a>


My, my. Bill has quite an ego!

Sid
 
J

Jukka K. Korpela

Sid Ismail said:
: <a name="bill" href="#bill">Bill</a>

My, my. Bill has quite an ego!

OK, let's change the example to
<a name="sid" href="#sid" title="sid" class="sid" rel="sid"
onmouseover="sid()" target="sid" type="text/x-sid">Sid</a>
 
S

Safalra

Vito Dolce LaPesca said:
<a href="#">Bill</a>

The problem is that the pound sign loads the page to the top. Is there a
way to keep the <a href> and have the user click on the link which keeps the
page exactly where it is and not go to the top?

As you're not actually using the link as a link, you should use something like:

<span class="someclassname">Bill</span>

with .someclassname:hover{color:red} or whatever in your stylesheet.

(By the way, since when has # been called a pound sign? # = hash, pound sign = £)

--- Safalra (Stephen Morley) ---
http://www.safalra.com/hypertext
 
N

Nik Coughin

Vito said:
Greets,
I have a listing of names:

Bill
Ann
Joe

When the user mouses over each name they turn a different color -
using
CSS - not javascript.

like:

a:hover{color:#fff000;

}

and the .html markup is:

<a href="#">Bill</a>

The problem is that the pound sign loads the page to the top. Is
there a way to keep the <a href> and have the user click on the link
which keeps the page exactly where it is and not go to the top?

Thank you.
TR

<a href="javascript:void(0)">Bill</a>?

Don't know if that is such a good idea, don't know how non-Javascript
enabled browsers will react to it. But it stops the page jump if you do
have JS enabled.

If it weren't for the fact that IE doesn't support the hover element
properly you could just do:

span:hover.redText
{
color: #F00;
}

and then:

<span class="redText">Bill</span>

Works in Mozilla. But because IE only lets you apply hover to a link (you
can't even do <a class="redText>Bill</a>, it has to be a goddamn link) you
can't use this and will probably have to go with the javascript:void(0).
Course, someone else on this NG might know better.
 
N

Nik Coughin

Safalra said:
As you're not actually using the link as a link, you should use
something like:

<span class="someclassname">Bill</span>

with .someclassname:hover{color:red} or whatever in your stylesheet.


Doesn't work in IE. IE only lets you use hover on links, AFAIK.
 
V

Vito Dolce LaPesca

Nik Coughin writes.
Doesn't work in IE. IE only lets you use hover on links, AFAIK.
.........................

And, that's a good reason since about 90% of the world uses IE.

However, this works:

<a href="#" onclick="return false;">Bill</a>
 
N

Nik Coughin

Vito said:
Nik Coughin writes.
Doesn't work in IE. IE only lets you use hover on links, AFAIK.
........................

And, that's a good reason since about 90% of the world uses IE.

However, this works:

<a href="#" onclick="return false;">Bill</a>

It relies on Javascript -- if they have Javascript disabled it will still
take them to the top of the document.

Whereas, if they have Javascript disabled the following link will simply do
nothing when clicked:

<a href="javascript:void(0)">Bill</a>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top