943,536 Members | Top Members by Rank

Ad:
Mar 24th, 2008
0

Drop down list Selected Value - Current Page

Expand Post »
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...?
Similar Threads
Reputation Points: 10
Solved Threads: 1
Newbie Poster
raywood5 is offline Offline
10 posts
since Jan 2005
Mar 24th, 2008
0

Re: Drop down list Selected Value - Current Page

here is the script:

html Syntax (Toggle Plain Text)
  1. <select id="jump">
  2.  
  3. <option value="http://localhost/page2.html" onclick="javascript:window.location = this.value;">page2</option>
  4. <option value="http://localhost/page1.html" onclick="javascript:window.location = this.value;">page1</option>
  5. <option value="http://localhost/page3.html" onclick="javascript:window.location = this.value;">page3</option>
  6.  
  7. </select>
  8. <script type="text/javascript">
  9. var slect=document.getElementById('jump');
  10. if(slect.value!==location.href){
  11. slect.value = location.href;
  12. }
  13. </script>
Reputation Points: 13
Solved Threads: 4
Junior Poster in Training
hunkychop is offline Offline
55 posts
since Mar 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: Javascript Problem with Ajax Respons
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Easy w Frames tough w CSS





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC