首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

js动态加载DropDownList,清空怎么实现

2013-06-25 
js动态加载DropDownList,清空如何实现我想在执行switch之前将DropDownList清空asp:TableRow Height40

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 )

热点排行