我可以看到我的所有JavaScript都在触发,除了我的上一次推送,它将转到PHP文件以生成报告(我正在使用HTML / JS>> PHP>> XML + XSLT>> FOP>> PDF)。
这是我的功能:
function doReport() {
var date = $("#myDate").val().replace(/\D/g, '');
if (date.length >= 6) {
var dateYY = date.substr(date.length - 4)
var dateMM = date.slice(0, -4)
} else if (date.length == 5) {
var dateYY = date.substr(date.length - 4)
var dateMM = date.slice(0, -4)
dateMM = '0' + dateMM;
} else {
var dateYY = date.substr(date.length - 2)
var dateMM = date.slice(0, -2)
dateYY = '20' + dateYY
};
var dateDD = '01';
// var sDate = dateMM + '-01-' + dateYY;
var sDate = new Date(dateYY, (dateMM -1 ), dateDD);
var eDate = new Date(dateYY, dateMM, 0);
var cDate = new Date();
var firstDay = new Date(cDate.getFullYear(), cDate.getMonth(), 1);
if (sDate >= firstDay) {
alert(' Please enter a month earlier than this month');
}
// alert('Month: ' + dateMM + ', Year: ' + dateYY + ', Full Date: ' + sDate + ' first day of month: ' + firstDay);
// alert('sDate: ' + sDate +' eDate: ' + eDate);
if (date == '') return alert('Missing Date - Please correct it.');
if (checkDateFld(date) === false) {
$('#myDate').focus();
return alert("Your starting date must be a valid date in mm-yyyy format.");
}
window.open('Apps/R_SatsEOM.php&sDate=' + sDate + '&eDate=' + eDate);
}
所有的验证都顺利进行,它会检查以确保报告的运行月份不会在将来,但是没有任何事情发生在:
window.open('Apps/R_SatsEOM.php&sDate=' + sDate + '&eDate=' + eDate);
应该开枪。我该怎么测试呢?我的JS有什么根本性的错误吗?或者我咆哮错误的树,这是一个PHP问题?