首页 > 解决方案 > 如何从 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')" />

标签: phpcodeigniterpagination

解决方案


@media print
{
.noprint {display:none;}
}

将类添加noprint到您的搜索框和分页。


推荐阅读