js或jquery实现页面打印可局部打印
方法一:直接用js的打印方法 <input id="btnPrint" type="button" value="打印" onclick="javascript:window.print();" /> 方法二:引用jquery插件打印(可以打印整个网页内容和网页的局部内容) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> </HEAD> <script type="text/javascript" src="jquery-1.9.1.min.js"></script> <script type="text/javascript" src="jquery.jPrintArea.js"></script> <BODY> <div id="print_button">打印</div> <div id="myPrintArea"> 这里面都是要打印出来的 </div> <script type="text/javascript"> $("div#print_button").click(function(){ $("div#myPrintArea").printArea(); }); </script> </BODY> </HTML>
文件下载地址:
https://files.cnblogs.com/qhorse/print.rar