<select id="Year" name="Year" class="sys_selectB mr10"> </select> <select id="Month" name="Month" class="sys_selectB mr10"> </select> <select id="Day" name="Day" class="sys_selectB mr10"> </select>
$("#City").change(function () { if ($("#City").val() != "0") Biz.Customer.Register.buildWarningMessage(jQuery("#City"), 0); }); for (var y = 2014; y > 1960; y--) { $("#Year").append(jQuery("<option></option>").val(y).html(y)); } for (var m = 1; m < 13; m++) { $("#Month").append(jQuery("<option></option>").val(m).html(m)); } InitDays($("#Year").val(), $("#Month").val()); $("#Year,#Month").bind("change", function () { InitDays($("#Year").val(), $("#Month").val()); }); function TGetDaysInMonth(iMonth, iYear) { var dPrevDate = new Date(iYear, iMonth, 0); return dPrevDate.getDate(); } function InitDays(iYear, iMonth) { var dDate = new Date(), daysInMonth = TGetDaysInMonth(iMonth, iYear), str = ""; $("#Day").empty(); for (var d = 1; d <= parseInt(daysInMonth); d++) { if (d == dDate.getDate()) { str = "<option value=" + d + " selected=true>" + d + "</option>"; } else { str = "<option value=" + d + ">" + d + "</option>"; } $("#Day").append(str); } }