Results 1 to 2 of 2

Thread: Linking to Other Parts of a Document

  1. #1

    Thread Starter
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765

    Linking to Other Parts of a Document

    I'm using a Listbox as my index of a really long page.

    I've added <a name="""> </a> around each of the areas that I want to link to, but what code do I have to add to send it the specific link???

    After I looked at the code for VBF, it uses onchange or something... but..
    Don't Rate my posts.

  2. #2
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444
    Something like this seems to work:

    Code:
    <form action="#" onsubmit="return false;"><div>
      <select onchange="document.location.hash=this.options[this.options.selectedIndex].value;">
        <option value="hash1">hash1</option>
        <option value="hash2">hash2</option>
        <option value="hash3">hash3</option>
      </select>
    </div></form>
    <h2><a name="hash1">hash1</a></h2>
    <p><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></p>
    <h2><a name="hash2">hash2</a></h2>
    <p><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></p>
    <h2><a name="hash3">hash3</a></h2>
    <p><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></p>
    You should note though that it will only work on JavaScript enabled browsers. What I would do is have the whole select and options bit written out via the document.write method and add a noscript section underneath that provides an alternative for people without JS.

Posting Permissions

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



Click Here to Expand Forum to Full Width