Jump to content

Creating a link to anchor text using javascript pull-down


9999

Recommended Posts

This is how my pull-down looks:

 

SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function formHandler(form){
var URL = document.form.site.options[document.form.site.selectedIndex].value;
window.location.href = URL;
}
// End -->
</SCRIPT>

<center>
<form name="form">
<select name="site" size=1 onChange="javascript:formHandler()">
<option value="">Choose Paragraph

<option value="#Paragraph1"> Paragraph 1 </option>
<option value="#Paragraph2"> Paragraph 2 </option>
<option value="#Paragraph3"> Paragraph 3 </option>

</select>
</form>
</center>

 

Further down on my page here is my anchors.  They are of course seperated with text in between them:

 

<a name="Paragraph1">Paragraph 1</a>
<a name="Paragraph2">Paragraph 2</a>
<a name="Paragraph3">Paragraph 3</a>

 

Someone told me I might need to change this line:

window.location.href = URL;

 

with this:

window.location = window.location + URL;

 

It stil doesn't work

Link to comment
Share on other sites

Does not do anything.  I just want it to move down the page to a differnt section.  Another example of this would be if you had one of the "go to top of page" things but you did it from a pull-down.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.