User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 374,176 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,439 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 2134 | Replies: 1
Reply
Join Date: Jan 2005
Posts: 9
Reputation: raywood5 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
raywood5 raywood5 is offline Offline
Newbie Poster

Drop down list Selected Value - Current Page

  #1  
Mar 24th, 2008
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...?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2007
Location: georgia
Posts: 55
Reputation: hunkychop is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 4
hunkychop's Avatar
hunkychop hunkychop is offline Offline
Junior Poster in Training

Re: Drop down list Selected Value - Current Page

  #2  
Mar 24th, 2008
here is the script:

  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>
toast
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 4:28 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC