|
-
Sep 29th, 2002, 02:00 AM
#1
Thread Starter
PowerPoster
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..
-
Sep 29th, 2002, 06:11 AM
#2
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|