form change with javascript

Posted by aslum on Stack Overflow See other posts from Stack Overflow or by aslum
Published on 2010-06-17T19:58:20Z Indexed on 2010/06/17 20:03 UTC
Read the original article Hit count: 312

I have two drop down lists

<select name="branch">
  <option value="b">Blacksburg</option>
  <option value="c">Christiansburg</option>
  <option value="f">Floyd</option>
  <option value="m">Meadowbrook</option>
</select>

but I would like the second list to be different based upon what is selected from the first list. So FREX Blacksburg's might be

<select name="room">
  <option value="Kitchen">Kitchen Side</option>
  <option value="Closet">Closet Side</option>
  <option value="Full">Full Room</option>
</select

While Christiansburg's is

<select name="room">
  <option value="Window">Window Side</option>
  <option value="Door">Door Side</option>
  <option value="Full">Full Room</option>

and of course the options are also different for the other branches...

Is it possible to change the second drop down list based on what they select for the first one? I have used javascript a teensy bit, but not much so please explain in detail.

Thanks!

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about form