function chkDays(){
    var f = document.form;
    var year = f.year.value;
    var month = parseInt(f.month.value,10);
    var length = 0;
   
    if (month == 4 || month == 6 || month == 9 || month == 11) {
        length=30;
    }else if(month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
        length=31;
    }else if ( (year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0) ) {
        length=29;
    }else{
        length=28;
    }

    f.day.length = length;
    for ( var i = 1; i <= length; i++) {
        if(i<10){
            f.day.options[i - 1].text = "0"+i;
            f.day.options[i - 1].value = "0"+i;
        }
        else{
            f.day.options[i - 1].text = i;
            f.day.options[i - 1].value = i;
        }
    }
}

+ Recent posts