links javascript in firefox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • oranoos3000
    New Member
    • Jan 2009
    • 107

    #1

    links javascript in firefox

    hi
    would you please help me,

    i'm working one a site project that summary of the content is shown in the first page and users with click continue link can see content completely

    i want to call a function with click continue link
    show_content is the a function that inside call a ajax request and fetch complete content and return and this content is shown in the special part of the page

    i write this code as follow

    Code:
    <a href="javascript:show_content(3);" onClick="return false;">continue</a>
    this code is run is IE correctly because in firefox dont
    act

    thanks alot for your help.
    Last edited by gits; Oct 8 '10, 10:06 AM. Reason: added code tags
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    the link should look like:

    Code:
    <a href="#" onclick="show_content(3); return false;">continue</a>

    Comment

    • Atli
      Recognized Expert Expert
      • Nov 2006
      • 5062

      #3
      You can also do:
      Code:
      <a href="javascript:void(0);" onclick="show_content(3); return false;">continue</a>
      That way you don't get the # added to the URL.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Even better, make it into a proper link (for those without JavaScript) and the return false will take care of the link not being followed for those with JavaScript enabled.

        Comment

        Working...