87,904
社区成员
发帖
与我相关
我的任务
分享
<select id="select_temp" onchange="changeOptions()"></select>
<script>
function changeOptions() {
var select_temp = document.getElementById("select_temp");
var value = select_temp.selectedIndex;
while (select_temp.firstChild) {
select_temp.removeChild(select_temp.firstChild);
}
for (var i = 0; i < 10; i++) {
var option = new Option(i, i);
if (i == value) option.selected = true;
select_temp.options.add(option);
}
}
changeOptions();
</script>
<select id="select_temp" onchange="changeOptions()"></select>
<script>
function changeOptions() {
var select_temp = document.getElementById("select_temp");
var value = select_temp.selectedIndex;
while (select_temp.firstChild) {
select_temp.removeChild(select_temp.firstChild);
}
for (var i = 0; i < 10; i++) {
var option = new Option(i, i);
select_temp.options.add(option);
}
select_temp.selectedIndex = value;
}
changeOptions();
</script>
var setElDate = function (noChangeOption) {
var yVal = $(sltYear).val(),
mVal = $(sltMonth).val(),
dVal = $(sltDay).val();
el.val(yVal + "-" + mVal + "-" + dVal);
if (noChangeOption) return;
jMiniCalendar.innerOption(sltDayId, 1, jMiniCalendar.getMaxDay(yVal, mVal), dVal);
};
$(sltDay).change(function () {
return setElDate(true);
});