...

View Full Version : How to connect anchors to drop-down-list?



kippie
01-11-2003, 07:59 AM
In the HTML below I would like to add anchor1, anchor2 and anchor3 to the choices choice1, choice2 and choice3. Can anyone help?

This is the HTML:
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<meta name="generator" content="Adobe GoLive 4">
<title>Welcome to Adobe GoLive 4</title>
</head>

<body>
<select name="select1" size="140" length="3">
<option VALUE="choice1" SELECTED>Choice1
<option VALUE="choice2" SELECTED>Choice2
<option VALUE="choice3" SELECTED>Choice3
</select>
<br>
<br>
<br>
<br>
<br>
<br><br>
<br>
<br><br>
<br>
<br><br>
<br>
<br><br>
<br>
<br>
<a name="anchor1"></a>Here is Anchor1<br>
<br>
<a name="anchor2"></a>Here is Anchor2<br>
<br>
<a name="anchor3"></a>Here is Anchor3<br>
</body>

</html>

Kippie

MCookie
01-11-2003, 10:34 AM
Something like this?


<html>
<head>
<title></title>
</head>
<body>
<form action=""><select name="warp" onchange="top.location.href =this.form.warp.options[this.form.warp.selectedIndex].value" size="140" length="3">
<option value="" selected="selected">Choose</option>
<option value="#anchor1">Choice1</option>
<option value="#anchor2">Choice2</option>
<option value="#anchor3">Choice3</option></select></form>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<a name="anchor1"></a>Here is Anchor1<br><br>
<a name="anchor2"></a>Here is Anchor2<br><br>
<a name="anchor3"></a>Here is Anchor3<br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</body>
</html>

redhead
01-11-2003, 10:38 AM
try this:

<select onchange="window.location=this.value;">
<option value="#anchor1">Choice 1</option>
<option value="#anchor2">Choice 2</option>
<option value="#anchor3">Choice 3</option>
</select>

<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<a name="#anchor1"></a>1<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<a name="#anchor2"></a>2<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<a name="#anchor3"></a>3<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>


not sure what browsers it will work in, only tested in IE6:thumbsup:

beaten... should have refreshed the page after testing the script... ah well...

kippie
01-11-2003, 11:46 AM
Thanks guys,

This helps! Now I changed the HTML (see below) and it goes fine. The only problem is that the listbox opens with "choice3" instead of "choose". Can that be changed also?

This is my new HTML:

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<meta name="generator" content="Adobe GoLive 4">
<title>Welcome to Adobe GoLive 4</title>
</head>

<body>
<a name="#up"></a>
<br>
<form name="ListBoxForm">
<p><select SIZE="1" NAME="ListBoxURL" onchange="location.hash=this[this.selectedIndex].value;">
<option value="" selected="selected">Choose</option>
<option VALUE="anchor1" SELECTED>Choice1
<option VALUE="anchor2" SELECTED>Choice2
<option VALUE="anchor3" SELECTED>Choice3
</select>
</form>
<br>
<a name="anchor1"></a>Here is Anchor1<br>
<a href="#up">Back-UP</a>
<br>
<a name="anchor2"></a>Here is Anchor2<br>
<a href="#up">Back-UP</a>
<br>
<a name="anchor3"></a>Here is Anchor3<br>
<a href="#up">Back-UP</a>

</body>
</html>

Kippie

MCookie
01-11-2003, 01:20 PM
Try replacing this (selecting all options...):

<option value="" selected="selected">Choose</option>
<option VALUE="anchor1" SELECTED>Choice1
<option VALUE="anchor2" SELECTED>Choice2
<option VALUE="anchor3" SELECTED>Choice3

with this:

<option value="" selected="selected">Choose</option>
<option VALUE="anchor1">Choice1</option>
<option VALUE="anchor2">Choice2</option>
<option VALUE="anchor3">Choice3</option>

kippie
01-11-2003, 02:35 PM
Great, thanks!

Kippie

zoobie
01-14-2003, 01:12 AM
Has anyone noticed when you click on a selection and it goes to the anchor, you scroll your wheelmouse thinking it's the page and instead, the selection box you just clicked on scrolls taking you to a new location? :rolleyes:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum