Results 1 to 4 of 4

Thread: Chained checkbox

  1. #1
    Join Date
    Mar 2006
    Location
    Buffalo, NY
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Chained checkbox

    I was wondering how I could have a checkbox that when selected displayed a selection box with values.

    If the checkbox was unchecked it would hide the selection box and then clear the value of the selection box.

    Any ideas?

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Mar 2006
    Location
    Buffalo, NY
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hmhmhm.... thats pretty cool.

    I am looking for something a little more simple.

    Just a checkbox, if selected it will show a selection box.

    Unchecked the selection box disappears.

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    <form action="">
      <div>
        <input type="checkbox" onclick="this.form.elements['myselect'].display = this.checked ? '' : 'none';">
        <select name="myselect">
          <option>An option</option>
          <option>Another option</option>
        </select>
      </div>
    </form>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •