1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8" />
- <title>{% if 'farmInfo' in data['setting'] %}{{data['setting']['farmInfo']['name']}} - {% end %}{{data['setting']['name']}}</title>
- <style>
- body{ text-align:center}
- .div{position:absolute;
- top:50%;
- left:50%;
- margin:-200px 0 0 -200px;
- width:400px;
- height:300px;
- </style>
- </head>
- <body>
- <div class="div">
- <img src="{{data['qrcode']}}" />
- <p class="noprint" url="{{data['url']}}"><input type="button" value="打印" onclick="javascript:window.print();" /> </p>
- </div>
- <!--将不需要打印的部分,标记为 class="noprint" -->
- <style type="text/css" media=print>
- .noprint{display : none }
- </style>
- <script>
- function preview(oper)
- {
- if (oper < 10)
- {
- bdhtml=window.document.body.innerHTML;//获取当前页的html代码
- sprnstr="<!--startprint"+oper+"-->";//设置打印开始区域
- eprnstr="<!--endprint"+oper+"-->";//设置打印结束区域
- prnhtml=bdhtml.substring(bdhtml.indexOf(sprnstr)+18); //从开始代码向后取html
- prnhtmlprnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));//从结束代码向前取html
- window.document.body.innerHTML=prnhtml;
- window.print();
- window.document.body.innerHTML=bdhtml;
- } else {
- window.print();
- }
- }
- </script>
- </body>
- </html>
|