php - 如何从 codeIgniter 的打印页面中删除搜索框和分页?
问题描述
我在 codeigniter 中使用 Jquery 数据表,现在我想打印网页,但我想在打印网页期间删除搜索框和分页。我怎样才能做到这一点?到目前为止,这是我的代码
<script type="text/javascript">
function PrintElem(elem)
{
Popup($(elem).html());
}
function Popup(data)
{
var mywindow = window.open('', 'new div', 'height=400,width=600');
mywindow.document.write('<html><head><title></title>');
/*optional stylesheet*/ //mywindow.document.write('<link rel="stylesheet" href="main.css" type="text/css" />');
mywindow.document.write('</head><body >');
mywindow.document.write(data);
mywindow.document.write('</body></html>');
mywindow.print();
mywindow.close();
return true;
}
</script>
<input type="button" value="Print" onclick="PrintElem('#yourdiv')" />
解决方案
@media print
{
.noprint {display:none;}
}
将类添加noprint
到您的搜索框和分页。
推荐阅读
- r - 计算前 6 个数据点的平均值
- javascript - 作为函数的结果增加特定元素的变量值
- excel - 选择前一个文件夹的文件夹对话框
- jmeter - 多次调用 JMeter 预处理器
- android - 如何在 firebase Live Database 中保存模型?
- graphics - Meshlab 没有可视化三角形的面,层格式错误?
- angular - @ngrx/store 不适用于 ng serve -prod
- containers - 构建 Container-Optimized OS - Swap SSH 实现
- php - Symfony中twig模板的通用代码(四)
- c# - EPPlus DeleteRow 不会向上移动行