javascript中的增量日历日期

javascript中的增量日历日期,javascript,java,calendar,Javascript,Java,Calendar,我正在编写代码,以便在选择月份和年份时动态添加行。它应该显示带有该月所有日期的标签行。 我已经编写了在单击按钮时添加新行的代码,并且在动态地向标签添加日期时遇到了问题 var计数=1; var numDays=“”; 虽然(count我已经找到了答案。实际上这是另一种锻炼方式 已获取日历中的天数(从服务器日期算起),并为每个计数运行循环,从而触发addrow按钮以递增标签值 JS代码=> numDays = "<%= numDays%>";

我正在编写代码,以便在选择月份和年份时动态添加行。它应该显示带有该月所有日期的标签行。 我已经编写了在单击按钮时添加新行的代码,并且在动态地向标签添加日期时遇到了问题


var计数=1;
var numDays=“”;

虽然(count我已经找到了答案。实际上这是另一种锻炼方式

已获取日历中的天数(从服务器日期算起),并为每个计数运行循环,从而触发addrow按钮以递增标签值

JS代码=>

            numDays = "<%= numDays%>";
            while (count <= numDays - 1) {
                  count = count + 1;
                  $("#btnAddRow").trigger("click");
            }

            function addRow(tableID) {
                var countCol = parseInt($('#dataTable').attr('data-countCol'), 10) || 1;
                countRow = countRow + 1;
                var index = $("#dataTable  tr:last").attr("id").split("_")[1];
                var rid = "r_" + (parseInt(index) + 1);
                var tempRow = $("#dataTable  tr:last").clone(true, true);
                tempRow.attr("id", rid);
                var checkCol = $('#dataTable tr:last td:first input');
                checkCol.prop("check", true);
                checkCol.prop("id", "check-" + index);
                var dateCol = $('#dataTable tr:last td:nth-child(2) input');
                dateCol.prop("readonly", true);
                var pv_dt = dateCol.val().split("/");
                pv_dt[0] = parseInt(pv_dt[0]) + 1;
                var nw_dt = pv_dt.join("/");
                $(tempRow).find('td:nth-child(2) input').val(nw_dt);
                tempRow.find('td:nth-child(3) input').prop('name', "rom_" + parseInt(countRow) + "." + countCol); 
                tempRow.find('td:nth-child(4) input').prop('name', "waste_" + parseInt(countRow) + "." + countCol); 
                tempRow.find('td:nth-child(5) input').prop('name', "fh_" + parseInt(countRow) + "." + countCol); 
                tempRow.find('td:nth-child(6) input').prop('name', "ot-rom_" + parseInt(countRow) + "." + countCol); 
                tempRow.find('td:nth-child(7) input').prop('name', "ot-waste_" + parseInt(countRow) + "." + countCol); 
                tempRow.find('td:nth-child(8) input').prop('name', "ot-FH_" + parseInt(countRow) + "." + countCol); 
                $('#dataTable').append(tempRow);
            }
numDays=”“;

而(count Umm
calendar
是一个Java对象,而不是Javascript。Java代码在服务器端计算。Javascript在客户端计算。客户端对Java变量一无所知。是否有办法在运行时通过cookie、会话或其他方式向客户端发送服务器数据?
            numDays = "<%= numDays%>";
            while (count <= numDays - 1) {
                  count = count + 1;
                  $("#btnAddRow").trigger("click");
            }

            function addRow(tableID) {
                var countCol = parseInt($('#dataTable').attr('data-countCol'), 10) || 1;
                countRow = countRow + 1;
                var index = $("#dataTable  tr:last").attr("id").split("_")[1];
                var rid = "r_" + (parseInt(index) + 1);
                var tempRow = $("#dataTable  tr:last").clone(true, true);
                tempRow.attr("id", rid);
                var checkCol = $('#dataTable tr:last td:first input');
                checkCol.prop("check", true);
                checkCol.prop("id", "check-" + index);
                var dateCol = $('#dataTable tr:last td:nth-child(2) input');
                dateCol.prop("readonly", true);
                var pv_dt = dateCol.val().split("/");
                pv_dt[0] = parseInt(pv_dt[0]) + 1;
                var nw_dt = pv_dt.join("/");
                $(tempRow).find('td:nth-child(2) input').val(nw_dt);
                tempRow.find('td:nth-child(3) input').prop('name', "rom_" + parseInt(countRow) + "." + countCol); 
                tempRow.find('td:nth-child(4) input').prop('name', "waste_" + parseInt(countRow) + "." + countCol); 
                tempRow.find('td:nth-child(5) input').prop('name', "fh_" + parseInt(countRow) + "." + countCol); 
                tempRow.find('td:nth-child(6) input').prop('name', "ot-rom_" + parseInt(countRow) + "." + countCol); 
                tempRow.find('td:nth-child(7) input').prop('name', "ot-waste_" + parseInt(countRow) + "." + countCol); 
                tempRow.find('td:nth-child(8) input').prop('name', "ot-FH_" + parseInt(countRow) + "." + countCol); 
                $('#dataTable').append(tempRow);
            }