不多说 先要引入插件
<script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="./js/jquery.jqprint-0.3.js"></script>
插件的使用
#print是你要打印区域的盒子
function print() {
$("#print").jqprint({
debug: false, //是否显示iframe查看效果
importCSS: true,
printContainer: true,
operaSupport: false
});
}
打印没有样式加上这句就可以了
<link rel="stylesheet" type="text/css" media="screen,print" href="css/print.css" />