Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2004
    Location
    watertown,SD
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    making combo box visible/hidden

    I would like to know how I can make a combo box visible or not visible depending on the selection in another combo box.

    Like...
    <select>
    <OPTIONvalue="Y">Yes</OPTION>
    <OPTIONvalue="N">No</OPTION></SELECT>



    if "Yes" was selected, the combo box would become visible ...if it was "no" the combo box would stay hidden.

    Thanks!

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    São Paulo, Brazil
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    ...
    
    function setVisible(pShow) {
        document.getElementById("id_of_the_other_select").style.display=(pShow ? "block" : "none");
    }
    
    </script>
    
    ...
    
    <select onchange="setVisible(this.options[this.selectedIndex].value);">
    <option value="1">Yes</option>
    <option value="0">No</option>
    ...
    /Daniel


  •  

    Posting Permissions

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