我测试了这个功能,并注意到打印页面根本没有根据else语句改变。有什么我做错了吗?
function handlePrint(event) {
var id = 'report-display';
var iframe = document.frames ? document.frames[id] : document.getElementById(id);
paginateReport = $("#paginateCheckBox").prop("checked");
if (!paginateReport) {
//parent.document.getElementById("#pageBreaker").style.pageBreakAfter = "auto";
}
else
{
//parent.document.getElementById("#pageBreaker").style.pageBreakAfter = "always";
$('head').append('<style type="text/css" media="print">.pageBreak {page-break-after: always;} .pageBreak:last-of-type{page-break-after: avoid;}}</style>');
}
var ifWin = iframe.contentWindow || iframe;
ifWin.focus();
ifWin.printPage();
return false;
}