日期:2014-05-16  浏览次数:20413 次

js动态加载DropDownList,清空如何实现
我想在执行  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
......           
 } 

------解决方案--------------------
document.getElementById("<%=yslx.ClientID %>").removeChild(document .getElementById ("<%=yslx.ClientID %>").firstChild )