Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Feb 2004
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts

    is using <span> the only way of getting rid of jumpiness for an onclick

    Let me elaborate. I am a newbie at this stuff, so I've just been using the <a> tag to trigger my javascripts. But one thing that i hate about that is the jumpiness it creates. I was told by somebody that I really should be using <span>, but then I lose the nifty pointer change and :hover :visited, effects. I know there is a work around, but I was really just trying to avoid anymore code. When I use <span> that sort of jumpiness which is caused by the href="#" goes away, but I was wondering if there was a way for me to keep using <a> and also avoid that jumpiness?

    By jumpiness I mean evertime I trigger a javascript it throws me back to the top of the page. Sometimes maybe I want to stay at the bottom of the page.

    Let me actually clarify, the jumpiness is caused by the href="#" not necessarily the <a> tag, but the href is also what gives my words that cool :hover effect, so the problem remains: How do I keep the roll-over effect without the jumpiness.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Nashua, NH
    Posts
    1,724
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The function that processes <a> onclick event should return false:
    Code:
    <a href="#" onclick="return processOnclick()">
    ....
    function processOnclick()
      { ... 
         return false;
      }
    That said, it takes ~10 lines of code to teach IE do hover and active with elements other than <a>: www.vladdy.net/demos/IEPseudoClassesFix.html
    You waste more bytes using <a> instead of <span>
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"


  •  

    Posting Permissions

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