title: javascript to disable/enable checkbox and dropdown menu
body: <p>Hi I am trying to disable a drop down when a checkbox is checked and the when the checkbox is unchecked enable the drop down. below is my javascript and it is working when I check the checkbox but it won't let me uncheck the checkbox:</p>
  
  <pre><code>     &lt;script type="text/javascript"&gt;
  
               function  test(obj){
  
                       if (document.getElementsByName("aForm[0].info")[0].checked = true) {  
                               alert("here");
                               document.getElementsByName("aForm[0].gender")[0].disabled = true; 
                      }
                       else document.getElementsByName("aForm[0].info")[0].checked = false;{
                       document.getElementsByName("aForm[0].gender")[0].enabled = true;
  
  
               }
               }
  
               &lt;/script&gt;
  </code></pre>
  
  <p>and here is my jsp</p>
  
  <pre><code>   &lt;logic:iterate id="data" name="aForm" property="testList"&gt;
              &lt;tr&gt;
  
                  &lt;td&gt;
                  &lt;html:checkbox indexed="true" name="aForm" styleId="something" property="info" onclick="test(this)"/&gt;
  
                  &lt;/td&gt;
                    &lt;td&gt;
                     &lt;html:select name="aForm" indexed="true" property="unit" styleId="dropdown"&gt;
                                      &lt;html:optionsCollection name="aForm" property="selectGender" value="value" label="label"/&gt;
                              &lt;/html:select&gt;
                              &gt;
                    &lt;/td&gt;
              &lt;/tr&gt;
          &lt;/logic:iterate&gt;
  </code></pre>