我想在执行  switch之前将DropDownList清空<asp:TableRow Height="40">
          <asp:TableCell ID="TableCell7" runat="server"  CssClass="tb_edit_text"  BackColor="#CFDEE9">
             <asp:Label ID="Label8" runat="server" Width="90px" Text="选择"  CssClass="tb_edit_label" />
             <asp:DropDownList runat="server" ID="yslx">
               
             </asp:DropDownList>
            <asp:Label ID="biaoti" runat="server" style="color:Red" CssClass="tb_edit_label" Text=""  />  
          </asp:TableCell> 
         
        </asp:TableRow>
<script type="text/javascript">
 switch(d)
           {
            case 1:
               document.all("yslx").add(new Option("1","1"));
               break
           case 2:
               document.all("yslx").add(new Option("2","2"));
              break
......           
 } 

解决方案 »

  1.   

    document.getElementById("<%=yslx.ClientID %>").removeChild(document .getElementById ("<%=yslx.ClientID %>").firstChild )
      

  2.   

    document.getElementById("<%=yslx.ClientID %>").options.length=0;//////// 
    switch(d)
               {
                case 1:
                   document.all("yslx").add(new Option("1","1"));
                   break
               case 2:
                   document.all("yslx").add(new Option("2","2"));
                  break
    ......           
     }