基礎(chǔ)jQuery實現(xiàn)的打印插件,只需要一句話就可以實現(xiàn)指定區(qū)域的打印
預(yù)覽:
<!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.3.2.js"></script>
<script type="text/javascript" src="jquery.jPrintArea.js"></script>
<BODY>
<div id="biuuu_button">print</div>
<div id="myPrintArea">
<table cellspacing="1" cellpadding="6" width="100%" class="tableData">
<thead>
<tr>
<th>Name</th>
<th>Major</th><th>Sex</th>
<th>English</th>
<th>Japanese</th>
<th>Calculus</th>
<th>Geometry</th>
</tr></thead>
<tbody>
<tr><td>Student01</td><td>Languages</td><td>male</td><td>80</td><td>70</td><td>75</td><td>80</td></tr>
<tr><td>Student02</td><td>Mathematics</td><td>male</td><td>90</td><td>88</td><td>100</td><td>90</td></tr>
<tr><td>Student03</td><td>Languages</td><td>female</td><td>85</td><td>95</td><td>80</td><td>85</td></tr>
<tr><td>Student04</td><td>Languages</td><td>male</td><td>60</td><td>55</td><td>100</td><td>100</td></tr>
</table>
</div>
<script type="text/javascript">
$("div#biuuu_button").click(function(){
$("div#myPrintArea").printArea();
});
</script>
</BODY>
</HTML>