SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Feb 2002
    Location
    Rochester, NY
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mirrored selects

    Hi folks,

    I've got two groups of <select>s for departure and return dates.

    I'd like for a change in the first set to be mirrored onto the second set... for example, if a user selects a departure month of "February" in the first <select>, the second would automatically switch to "February" too. Editing the second set would not cause the same thing to happen.

    Any ideas?

  2. #2
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    all you would have to do is grab the selectedIndex of select box one and then set the second box's selectedIndex to the same value... something like:

    select2.selectedindex = select1.selectedIndex;

    you can set up a function to do this using the onchange event of the first select box..

    <select id='boxOne' onchange='someFuntion(this);'>

    you pass "this" to the function so you can get its selectedIndex easily.. something like:

    function someFunction(box) {
    document.getElement("box2").selectedIndex = box.selectedIndex;
    }

    Im not gonna write the function for you but I think there's enough here to get started.

  3. #3
    SitePoint Zealot
    Join Date
    Feb 2002
    Location
    Rochester, NY
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, that gave me enough to go on to get it working!


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
  •