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

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

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

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


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

// 動(dòng)態(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)文章

最新評(píng)論