在我的Yii Web应用程序中,我使用divToPrint从div内容中打印出来。在div中有一个类表响应响应表。因为这个类显示了滚动条。当我从这个div中取出打印件时,该滚动条的颜色也出现在该打印件中。如何避免打印出滚动条。对于打印,使用以下功能
function printDiv(divName) {
var divToPrint = document.getElementById(divName);
var popupWin = window.open('', '', 'width=300,height=300');
popupWin.document.open();
popupWin.document.write('<html><body onload="window.print()">');
popupWin.document.write('<link href="<?php echo Yii::app()->request->baseUrl ?>/css/assets/css/minified/ccebootstrap.min.css" rel="stylesheet" type="text/css">');
popupWin.document.write('<link href="<?php echo Yii::app()->request->baseUrl ?>/css/assets/css/minified/core.min.css" rel="stylesheet" type="text/css">');
popupWin.document.write('<link href="<?php echo Yii::app()->request->baseUrl ?>/css/reportcardstyle.css" rel="stylesheet" type="text/css">');
popupWin.document.write(divToPrint.innerHTML + '</html>');
popupWin.document.close();
}
答案 0 :(得分:0)
它与Yii无关,因为它是PHP框架。
在包含滚动条的元素上使用css overflow: visible;
。