I want to us a simple HTML drop down lists (<select name="menu"....) as a quick jump between a couple of different html pages. I was able to come up with the script to have the pages jump to the URLs. However, I was hoping to have the current page dynmically selected. For example, If I am on the page for Nike Running Shoes (nike-running-shoes.html) that value in the drop down would be selected.

Any suggestions...?

here is the script:

<select id="jump">

  <option value="http://localhost/page2.html" onclick="javascript:window.location = this.value;">page2</option>
  <option value="http://localhost/page1.html" onclick="javascript:window.location = this.value;">page1</option>
  <option value="http://localhost/page3.html" onclick="javascript:window.location = this.value;">page3</option>
  
</select>
<script type="text/javascript">
var slect=document.getElementById('jump');
if(slect.value!==location.href){
	slect.value = location.href;
}
</script>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.