Skip to main content
nigelh70638339
Inspiring
December 3, 2017
Answered

How to stop jumping to top of page after clicking a link

  • December 3, 2017
  • 1 reply
  • 4872 views

As my head says how can I stop this annoying behavior?

An example of my code:

<a href="#" onClick="MM_openBrWindow('winning_moves_stts/groot.html','','width=320px,height=200px')" onMouseOver="MM_swapImage('Groot','','images/stts/draxback.gif',1)" onMouseOut="MM_swapImgRestore()"><img id="Groot" src="images/stts/groot.gif" alt="Groot"></a>

Thank you in advance!

    This topic has been closed for replies.
    Correct answer B i r n o u

    The links take you to another page so I am thinking that the second link is the one I need.


    Have you try adding a return false, at the end of the click listener... ?

    that way

    <a href="#" onClick="MM_openBrWindow('winning_moves_stts/groot.html','','width=320px,height=200px'); return false;" onMouseOver="MM_swapImage('Groot','','images/stts/draxback.gif',1)" onMouseOut="MM_swapImgRestore()">

    1 reply

    Nancy OShea
    Community Expert
    Community Expert
    December 3, 2017

    <a href="#"

    You could give your href a valid URL and ID on the target page.

    Nancy O'Shea— Product User & Community Expert
    nigelh70638339
    Inspiring
    December 3, 2017

    Nancy, do you mean like link it to itself?

    <a href="http://www.ultimate-top-trumps.co.uk/'webpage'#groot" onClick="MM_openBrWindow('winning_moves_stts/groot.html','','width=320px,height=200px')" onMouseOver="MM_swapImage('Groot','','images/stts/draxback.gif',1)" onMouseOut="MM_swapImgRestore()"><img id="Groot" src="images/stts/groot.gif" alt="Groot"></a>

    Nancy OShea
    Community Expert
    Community Expert
    December 3, 2017

    I'm not sure what your goal is.  A link usually takes people to some destination, either on the same page, a new page or an external link.

    3 LINKS EXAMPLE:

    <a href="#uniqueID">Same Page</a>

      |

    <a href="some_page.html#uniqueID">New Page & ID</a>   |

    <a href="https://example.com">External link</a>

    <div id="uniqueID">This is a division with a unique ID.</div>

    Nancy O'Shea— Product User & Community Expert