1.动态创建select function createSelect(){ var mySelect = document.createElement_x("select"); mySelect.id = "mySelect"; document.body.appendChild(mySelect); } 2.添加选项option function addOption(){ //根据id查找对象, var obj=document.getElementByIdx_x
<select id="year" style="width: 100px;"></select> <select id="month" style="width: 100px;"></select> //初始化年 var now = new Date(); var nowYear = now.getFullYear();