Links

Discussion in 'HTML' started by Vito Dolce LaPesca, Feb 23, 2004.

  1. 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
     
    Vito Dolce LaPesca, Feb 23, 2004
    #1
    1. Advertising

  2. "Vito Dolce LaPesca" <> wrote:

    > 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>

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Feb 23, 2004
    #2
    1. Advertising

  3. Vito Dolce LaPesca

    Sid Ismail Guest

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

    : 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
     
    Sid Ismail, Feb 23, 2004
    #3
  4. Sid Ismail <> wrote:

    > : <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>

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Feb 23, 2004
    #4
  5. Vito Dolce LaPesca

    Safalra Guest

    "Vito Dolce LaPesca" <> wrote in message news:<>...
    > <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
     
    Safalra, Feb 23, 2004
    #5
  6. Vito Dolce LaPesca

    Nik Coughin Guest

    Vito Dolce LaPesca wrote:
    > 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.
     
    Nik Coughin, Feb 23, 2004
    #6
  7. Vito Dolce LaPesca

    Nik Coughin Guest

    Safalra wrote:

    > 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.
     
    Nik Coughin, Feb 23, 2004
    #7
  8. 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>
     
    Vito Dolce LaPesca, Feb 23, 2004
    #8
  9. Vito Dolce LaPesca

    Nik Coughin Guest

    Vito Dolce LaPesca wrote:
    > 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>
     
    Nik Coughin, Feb 23, 2004
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rashmi Panduranga

    Links required

    Rashmi Panduranga, May 16, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    508
    Alvin Bruney [MVP - ASP.NET]
    May 23, 2005
  2. Takuon Soho

    VHDL To C? Ghezzi Links Broken

    Takuon Soho, Feb 11, 2005, in forum: VHDL
    Replies:
    2
    Views:
    676
    Takuon Soho
    Feb 12, 2005
  3. Replies:
    1
    Views:
    516
    Squidge
    May 27, 2005
  4. www.westerncartooncards.ca

    Exchange Links < Western Cartoon Cards > Exchange Links

    www.westerncartooncards.ca, Jul 12, 2004, in forum: HTML
    Replies:
    2
    Views:
    1,252
    Toby Inkster
    Jul 12, 2004
  5. Garrett Smith
    Replies:
    14
    Views:
    311
    David Mark
    May 26, 2009
Loading...

Share This Page