其他分享
首页 > 其他分享> > js 年月进行比较

js 年月进行比较

作者:互联网

1:

var jhny = "";
var ayear = new Date().getFullYear();
var amonth = new Date().getMonth() + 1;
var adate = new Date((ayear + "-" + amonth + "-01").replace("-", "/"));
for (var z = 0; z < trs.length; z++) {
    if (trs[z].cells[7].getElementsByTagName("INPUT")[0].value != "") {
        var aadate = new Date((trs[z].cells[7].getElementsByTagName("INPUT")[0].value + "-01").replace("-", "/"));
        if (aadate < adate) {
            if (jhny == "") {
                jhny = 1;
            } else {
                jhny = jhny+","+(z+1);
            }
        }
    }
}
    if (jhny!="") {
    alert("第"+jhny+"行收入年月不能小于当前年月!!");
    return false;
}

标签:aadate,js,Date,new,var,jhny,trs,比较,进行
来源: https://www.cnblogs.com/chenze-Index/p/12061727.html