根据jsp中第一个下拉列表中的选择选择另一个下拉列表

时间:2011-02-20 03:20:25

标签: javascript jsp struts

我有下面的下拉菜单。当用户在第一个下拉列表(帐户)中选择一个条目时,我需要选择第二个下拉列表(电子邮件)。如果选择了accountid2,则必须选择email-id2。如果是其他,则应选择其他。如何使用onchange函数来做到这一点。

        <td>11.member's&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<br>Account Number:&nbsp <br />
            <span class="bodyCopy"></span> 
        <html:select name="DataForm" property="accountNumber" styleClass="formContent" 
             style="width:80px" >    
           <option value = "0">Other  </option> 
         <c:if test = "${!empty Data.accountId2}">
          <option value = "1">${Data.accountId2}</option>  
        </c:if>
          <c:if test = "${!empty Data.accountId1}">
            <option value = "2">${Data.accountId1}</option>
          </c:if>
           <c:if test = "${!empty Data.accountId3}">
         <option value = "3">${Data.accountId3}</option>
          </c:if>
          <c:if test = "${!empty Data.accountId4 }">
         <option value = "4">${Data.accountId4}</option>
          </c:if>
         <c:if test = "${!empty Data.accountId5}">
         <option value = "5">${Data.accountId5}</option>
          </c:if>
       </html:select> 
        </td>

        <td colspan="3">12. Member's<br>E-mail Address: <br />

        <span class="bodyCopy"  ></span> 

         <html:select  name="DataForm" property="emailAddress" style = "width:150px"
          styleClass="formContent" >    
            <option value = "0">Other  </option> 
          <c:if test = "${!empty Data.primaryEmail2}">
          <option value = "1">${Data.primaryEmail2}</option>  
         </c:if>
          <c:if test = "${!empty Data.primaryEmail1}">
            <option value = "2">${Data.primaryEmail1}</option>
          </c:if>
           <c:if test = "${!empty Data.primaryEmail3}">
         <option value = "3">${Data.primaryEmail3}</option>
          </c:if>
          <c:if test = "${!empty Data.primaryEmail4}">
         <option value = "4">${Data.primaryEmail4}</option>
          </c:if>
         <c:if test = "${!empty Data.primaryEmail5}">
         <option value = "5">${Data.primaryEmail5}</option>
          </c:if>
           </html:select>
        </td>

1 个答案:

答案 0 :(得分:0)