SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    monitormensch oerdec's Avatar
    Join Date
    Sep 2004
    Location
    Hamburg
    Posts
    706
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    alternative to <a href="#"

    Hi,

    By using <a href="#" onclick="... the page jumps to the top. Does anybody know a good alternative?

    OK, I could write the siteīs URL in the href attribute but that means the page reloads every time.

    Isnīt there a Null link or something?


    oerdec

  2. #2
    SitePoint Addict
    Join Date
    Sep 2004
    Location
    Kelowna, BC
    Posts
    202
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <a href="#" onclick="window.open('params...'); return false;">

    putting the "return false" in should make that not happen.

  3. #3
    monitormensch oerdec's Avatar
    Join Date
    Sep 2004
    Location
    Hamburg
    Posts
    706
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks, thatīs what I was searching for.

  4. #4
    SitePoint Guru
    Join Date
    Feb 2005
    Posts
    602
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not quite sure what you're asking for, but you could use:

    <a href="javascript:void(0)" onclick="...">

    to make it not go to the top.

  5. #5
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    an anchor will validate without a href.
    So you can just use <a onclick="function()">
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  6. #6
    monitormensch oerdec's Avatar
    Join Date
    Sep 2004
    Location
    Hamburg
    Posts
    706
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    really? thatīs new to me, thanks.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •