Link to same page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phpmagesh
    New Member
    • Nov 2008
    • 119

    #1

    Link to same page

    Hi to all,

    I am trying to do some link management in my page, that is i have few contents in my page each have his own headings, like

    links:

    > heading 1
    > heading 2
    > heading 3

    contents:

    heanding1
    xxxx
    yyyyy
    yyyy
    yyyy

    heading 2
    xyz
    xyz
    xyz

    heading 3
    123
    1231
    123456

    Now what i want to do is, i want to create a link for every headings like

    <a href=#heading1> heading1</a>

    When the user clicks in that link, then the content for that link should come up to the front,

    this task is already furnished in wikipedia - sample

    i want the same process for my page..

    Can anyone help me please,

    Thanks in advance,

    Regards
    magesh
  • Mr Prister
    New Member
    • Nov 2008
    • 12

    #2
    I take it you mean the content section of the Wiki page.
    Could you not use anchors on your headers?

    eg.
    <a name = "header1">headi ng 1</a>
    Header 1 Contents

    Then for you link just <a href = "#header1"> Header 1 </a>

    Is that what your looking for?
    Mr. Prister

    Comment

    • phpmagesh
      New Member
      • Nov 2008
      • 119

      #3
      Originally posted by Mr Prister
      I take it you mean the content section of the Wiki page.
      Could you not use anchors on your headers?

      eg.
      <a name = "header1">headi ng 1</a>
      Header 1 Contents

      Then for you link just <a href = "#header1"> Header 1 </a>

      Is that what your looking for?
      Mr. Prister
      Hi

      Thank you dude,

      Regards
      magesh

      Comment

      • Mr Prister
        New Member
        • Nov 2008
        • 12

        #4
        Another Thought

        Hi there... no probs,

        Just thought if you actually using header tags

        eg. <h1>Header 1</h1>

        Then you can simply give the header an ID:
        <h1 id = "header 1">Header 1</h1>
        Then reference that just like you would the anchor.

        I don't think it matters which you use but that one looks nice!
        Last edited by Mr Prister; Dec 12 '08, 10:18 AM. Reason: the other one didn't work propper!

        Comment

        • Dormilich
          Recognized Expert Expert
          • Aug 2008
          • 8694

          #5
          Originally posted by Mr Prister
          Then you can simply give the header an ID:
          <h1 id = "header 1">Header 1</h1>
          except that whitespace is not allowed in an ID. (only letters, digits, underscores, hyphens, periods and colons)

          regards

          Comment

          • Mr Prister
            New Member
            • Nov 2008
            • 12

            #6
            Oh my!

            Originally posted by Dormilich
            except that whitespace is not allowed in an ID. (only letters, digits, underscores, hyphens, periods and colons)

            regards

            Damn you with your correctness and damn me for the mistake... but a valid point none the less.

            Comment

            • Dormilich
              Recognized Expert Expert
              • Aug 2008
              • 8694

              #7
              Originally posted by Mr Prister
              Damn you with your correctness and damn me for the mistake... but a valid point none the less.
              damn yes. I'm sure there are a lot of people out there who do not know that fact.

              Comment

              Working...