<script type="text/javascript">
var month = new Array(11);
month[0] = "01";
month[1] = "02";
month[2] = "03";
month[3] = "04";
month[4] = "05";
month[5] = "06"
month[6] = "07";
month[7] = "08";
month[8] = "09";
month[9] = "10";
month[10] = "11";
month[11] = "12";
var date = new Date();
getYear();
getMonth();
function getYear() {
var opt = document.createElement("option");
document.getElementById("YY").options.add(opt);
var currentyear = date.getFullYear();
for (var i = 1977; i < currentyear; i++) {
var item = new Option(i, i);
document.getElementById("YY").options.add(item);
}
}
function getMonth() {
var opt = document.createElement("option");
document.getElementById("MM").options.add(opt);
for (var i = 0; i <= 11; i++) {
var item = new Option(month[i], month[i]);
document.getElementById("MM").options.add(item);
}
}
</script>
No comments:
Post a Comment