2016-11-07 67 views
0

在我的Yii web應用程序中,我使用divToPrint打印出div內容。在div中有一個類表響應響應表的類表。因爲這個類顯示滾動條。當我從這個div中打印出來時,該滾動條的顏色也出現在該打印中。如何避免滾動條被打印出來。對於打印使用以下功能,避免滾動條從yii打印

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

它與Yii無關,因爲它是PHP框架。

在包含滾動條的元素上使用css overflow: visible;