<admintpl file="header" /> <!-- 引用你自己的就好了 没有就不用了-->
<style> <!-- 看起来好看一些 -->
.table .text-center,
.table .text-center th,
.table .text-center td { text-align:center; }
.table thead th { vertical-align:middle; }
.shebao_fail { color:#e74c3c; text-decoration:line-through; }
.suspend { color:#F93; text-decoration:line-through; }
/* print style */
caption h2 { font-size:22px; }
.table { font-family:"宋体"; }
.table .nowrap { white-space:nowrap; word-break:break-all; }
.table-bordered { border:1px solid #333; border-left:0px solid #333; border-collapse:collapse; }
.table th, .table td { border: 1px solid #333; }
.table-bordered th, .table-bordered td { border: 1px solid #333; }
.table>thead>tr>th { border-bottom: 0px solid #333; }
.table-condensed th, .table-condensed td { padding:0px 5px; }
.qihai_logo { position:relative; }
.qihai_logo_gray { position:absolute; left:0px; top:-5px; z-index:-1; }
#article_content img{height:auto !important}
#article_content {word-wrap: break-word;}
.btn {margin-top: 33px;}
</style>
</head>
<body>
<div class="wrap js-check-wrap">
<!--startprint-->
<div id="article_content"> <!--需要展示的数据 自行修改 我用的tp-->
{$result['post_content']}
</div>
<!--endprint-->
<div class="form-actions">
<a class="btn btn-primary" onClick="doPrint()">打印</a>
</div>
</div>
<script type="text/javascript">
<!--打印操作-->
function doPrint() {
bdhtml=window.document.body.innerHTML;
sprnstr="<!--startprint-->";
eprnstr="<!--endprint-->";
prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
window.document.body.innerHTML=prnhtml;
window.print();
window.document.body.innerHTML=bdhtml;
}
</script>
</body>
</html>
html页面打印功能实现
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- SessionStorage:将数据保存在session对象中,所谓session是指用户在浏览某个网站时,从进入...