PDA

View Full Version : Setting an achor as a value in a drop down menu


lux
04-26-2006, 11:31 AM
I would like to use a drop down menu to choose from a number of anchor links to anchors on the same page.

I cant get my head around what should be used as the value in the drop down box???

If anyone has any advise or a tutorial that would be really helpful

thanks!

davidj
04-26-2006, 11:51 AM
here is a test page

run this as it is and then learn from it

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript" type="text/javascript">

function anchors1(){

gt = document.getElementById('anc');
an = gt.value;

document.location.href='thispage.htm#'+an;

}

</script>

</head>

<body>



<select name="select" onchange="anchors1()" id="anc">
<option>select</option>
<option value="no1">no1</option>
<option value="no2">no2</option>
<option value="no3">no3</option>
<option value="no4">no4</option>
<option value="no5">no5</option>
</select>
</p>


</p>


x</p>


</p>


</p>


<a name="no1" id="no1"></a></p>


</p>


</p>


</p>


</p>


</p>


</p>


</p>


wwww</p>


<a name="no2" id="no2"></a></p>


</p>


</p>


</p>


</p>


</p>


sssss</p>


<a name="no3" id="no3"></a></p>


</p>


</p>


</p>


</p>


</p>


</p>


ddddd</p>


<a name="no4" id="no4"></a></p>


</p>


</p>


</p>


</p>


</p>


fffff</p>


<a name="no5" id="no5"></a></p>
</body>
</html>

lux
04-26-2006, 01:35 PM
thank you for the quick responce

regards