亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

JS動態(tài)添加與刪除select中的Option對象(示例代碼)

 更新時(shí)間:2013年12月25日 09:42:28   作者:  
本篇文章主要介紹了JS動態(tài)添加與刪除select中的Option對象示例代碼。需要的朋友可以過來參考下,希望對大家有所幫助
如下所示:
復(fù)制代碼 代碼如下:

//動態(tài)刪除select中的所有options:  
function delAllOptions(){ 
      document.getElementById("user_dm").options.length=0;  


//動態(tài)刪除select中的某一項(xiàng)option:   
function delOneOption(index){ 
      document.getElementById("user_dm").options.remove(index);  

// 動態(tài)添加select中的項(xiàng)option:   
function addOneOption(){ 
      //document.getElementById("user_dm").options.add(new Option(2,"mytest"));   

   var selectObj=document.getElementById("user_dm"); 
   alert(selectObj.length); 
   selectObj.options[selectObj.length] = new Option("mytest", "2"); 

相關(guān)文章

最新評論