Results 1 to 2 of 2

Thread: Select menu - dynamically jump to an <option> item

  1. #1
    Join Date
    Nov 2005
    Location
    Austin TX,US
    Posts
    71
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Select menu - dynamically jump to an <option> item

    Hi,

    I have 2 pages with details as follow:
    Code:
    PAGE 1: a pulldown Select menu with a couple of items and an
     onchange event which will show and hide content [on the same page]
     depending on user's selection
    
    <!--Pulldown -->
    <select name="drop1" onchange="hideAll_TouchOs(); 
    showTouchOs(this.options[selectedIndex].value);">
      <option selected>Select Your Operating System</option>
      <option value="WVista">Windows Vista</option>
      <option value="WVista64">Windows Vista (64-bit)</option>
      <option value="WXP">Windows XP</option>
      <option value="W2000">Windows 2000</option>
      </select>
    
    <!--Content to be shown or hidden-->
    ........ Blah blah ...........
    
    PAGE 2:  the same pulldown and no other content. When people
     select from here, the pulldown will take them to PAGE 1 and show the 
    correct content on PAGE 1. I did this through passing some parameters in the url.
    
    <!--The same Pulldown -->
    <select name="drop1" onchange="hideAll_TouchOs(); 
    showTouchOs(this.options[selectedIndex].value);">
      <option selected>Select Your Operating System</option>
      <option value="WVista">Windows Vista</option>
      <option value="WVista64">Windows Vista (64-bit)</option>
      <option value="WXP">Windows XP</option>
      <option value="W2000">Windows 2000</option>
      </select>
    Everything works out ok, except: if people select e.g. Windows XP on PAGE 2, Windows XP content shows on PAGE 1, but the pulldown itself still starts with "Select your Operating Systems."

    Is there a way to make the pulldown to jump to "Window XP" instead of "Select your Operating Systems"?

    Thanks for your input!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That sort of functionality (saving and reporting back on previous form element choices) is generally the province of server side code like asp or PHP, not client side code like javascript. However, javascript can be used to detect the user's OS and many other things, so actually asking them to choose is unnecessary, unless their browser is (as some can) spoofing another OS.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •