print.html 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  6. <title>打印申请单</title>
  7. <style type="text/css">
  8. body {
  9. left: 0px;
  10. top: 0px;
  11. right: 0px;
  12. bottom: 0px;
  13. margin: 0px;
  14. font-family: Arial, Helvetica, sans-serif;
  15. font-size: 12px;
  16. overflow: hidden;
  17. white-space: nowrap;
  18. }
  19. </style>
  20. <script src="../../static/print/jquery-2.0.3.js" type="text/javascript"></script>
  21. <script src="../../static/print/jquery.jPrintArea.js" type="text/javascript"></script>
  22. </head>
  23. <body>
  24. <div>
  25. <input type="button" style="height: 30;" id="print_button" value="打印"/>
  26. <fieldset align="">
  27. <legend>打印区</legend>
  28. <div id="myPrintArea" style="height: 1500;">
  29. <div align="center">
  30. <SPAN style="TEXT-DECORATION: underline;font-size:25px">进口食品冷链申报信息表</SPAN>
  31. <br/><br/>
  32. </div>
  33. <div style="text-align:center; font-size:15px;he">
  34. <table width="100%" style="border-collapse:collapse;border:none;">
  35. </table>
  36. </div>
  37. <div align="right">
  38. <br/><br/>
  39. <SPAN style=";font-size:15px"> &nbsp&nbsp&nbsp&nbsp 年 &nbsp&nbsp&nbsp&nbsp 月 &nbsp&nbsp&nbsp&nbsp 日</SPAN>
  40. </div>
  41. </div>
  42. </fieldset>
  43. </div>
  44. <script type="text/javascript">
  45. $(function () {
  46. $("#print_button").click(function () {
  47. $("#myPrintArea").printArea();
  48. });
  49. function getUrlParam(name) {
  50. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
  51. var r = window.location.search.substr(1).match(reg); //匹配目标参数
  52. if (r != null) return unescape(r[2]);
  53. return null; //返回参数值
  54. }
  55. var id = getUrlParam('id');
  56. $.ajax({
  57. url: 'http://192.168.3.74:8099/pro/TbDeclare/getById?id=' + id,
  58. type: 'post', // 请求类型,常用的有 GET 和 POST
  59. success: function (data) { // 接口调用成功回调函数
  60. $("#myPrintArea").printArea();
  61. }
  62. });
  63. });
  64. </script>
  65. </body>
  66. </html>