Re: stopping <a> from loading new page but still performing onclick action



Sometimes this could cause a problem by jumping to the top of the page.
Another way to do this without making the page jump would be to put (<a
href="javascript:void(0)" onclick="SomeFunction()">)

gbbulldog wrote:
monomaniac21 wrote:
hi all

i want to use hyperlinks to 'load' content by changing the display of
div tags. the problem i have is that unless i specify a href the anchor
does not change the mouse pointer on hover even if display is set to
block. it only look changes when there is a href there. but if i have a
href there then when i click it will load the page, which i dont want.

how can i get the anchor to look like a proper link where the users
pointer changes on hover (in firefox) but a page does not get refreshed
onclick only the onclick function gets loaded.

regards

marc

Place a single hash into the href property of the anchor tag.
(href="#").

.



Relevant Pages

  • Re: Hover Question
    ... Furthermore the anchor must contain a link for IE ... to display the properties of the:hover psuedoclass. ... unwise to apply:hover properties to anything except links. ... Nick Theodorakis ...
    (alt.html)
  • Re: OK, Next Question.
    ... The anchor text is important both to people and search ... I put it up for them to look at and if they like the hover then they get it. ... I do this for low pay and few perks, like I get to buy my own gas to travel to CNRCC meetings in San Luis Obispo, and pay for the food also. ...
    (alt.html)
  • Re: OK, Next Question.
    ... I agree with Jukka and others that it is better to keep things simple ... The anchor text is important both to people and search ... and it is better not to ask of people to hover over a link in order to ...
    (alt.html)
  • finding the position of a li element
    ... when a user clicks on an anchor inside a li that is contained in a ul inside a div I would like to find the x coordinate of that li. ... The li has an onclick function but I can't figure out how to get the top value of the li ...
    (comp.lang.javascript)