I want to include the css files inside the javascript tags using base_url(). I want to print a specific div using the javascript in codeigniter view with css.
my script part:
function printDiv(divName) {
var printContents = document.getElementById(divName).innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
}
<input type="button" onclick="printDiv('printableArea')" value="print a div!" />
<div class="panel panel-primary" id="printableArea">
I want to print this content here.
</div>
i want to print the text only inside the div when i click the button.can anyone help??
如果您只想打印特定的CSS,则应直接将其包含在codeigniter视图页面中,并将介质类型指定为print。
<link rel="stylesheet" type="text/css" href="print.css" media="print">
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.