`

Select 动态添加节点

 
阅读更多

var year = nodes[i].text; 
  var oOptionBegin = document.createElement("option");
  oOptionBegin.appendChild(document.createTextNode(year));
  oOptionBegin.setAttribute("value","test");
  begin.appendChild(oOptionBegin);

 

 

 

//  获取所选中的Select的值

var begin =  document.getElementById("beginYear").options[document.getElementById("beginYear").selectedIndex].text;

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics