<html>
<head>
<script type="text/javascript" src="jQprint/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="jQprint/jquery.jqprint-0.3.js"></script>
<link rel="stylesheet" href="jQprint/print.css" media="print"/>
</head>
<style>
.trClass{
width:250px;
height:40px;
}
.tdClass{
width:100px;
height:40px;
}
</style>
<script type="text/javascript">
function testPrint(obj){
$("#"+obj).jqprint();
}
</script>
<body>
<button onclick="testPrint('divObject')">打印</button>
<div id="divObject">
<table border="1">
<tr class="trClass">
<td class="tdClass">1</td>
<td class="tdClass">2</td>
<td>a</td>
</tr>
<tr class="trClass">
<td class="tdClass">3</td>
<td class="tdClass">4</td>
<td>b</td>
</tr>
<tr class="trClass">
<td class="tdClass">5</td>
<td class="tdClass">6</td>
<td>c</td>
</tr>
</table>
</div>
<div id="divObjectTwo">
<table border="1">
<tr class="trClass">
<td class="tdClass">11</td>
<td class="tdClass">22</td>
</tr>
<tr class="trClass">
<td class="tdClass">33</td>
<td class="tdClass">44</td>
</tr>
<tr class="trClass">
<td class="tdClass">55</td>
<td class="tdClass">66</td>
</tr>
</table>
</div>
</body>
</html>
转载于:https://www.cnblogs.com/chonghaojie/p/9522128.html