zoukankan      html  css  js  c++  java
  • 打印

    <!DOCTYPE html>
    <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
    <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
    <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
    <!--[if gt IE 8]><!-->
    <html class="no-js">
    <!--<![endif]-->
    <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>jQuery.Print</title>
    <meta name="description" content="jQuery.print is a plugin for printing specific parts of a page">
    <meta name="viewport" content="width=device-width">

    <!--[if lt IE 9]>
    <script src="js/vendor/html5-3.6-respond-1.1.0.min.js"></script>
    <![endif]-->
    </head>
    <body>

    <div id="ele4" class="b">
    <h3 class='avoid-this'>Element 4</h3>
    <p>
    Some really random text.
    </p>
    <table width='8000'>
    <tr>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    </tr><tr>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    </tr><tr>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    </tr><tr>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    </tr><tr>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    <td>111</td>
    </tr>
    </table>

    <button class="print-link avoid-this">
    Print this in a new window, without this button and the title
    </button>
    </div>
    <br/>
    <button class="print-link" onclick="jQuery.print()">
    Print page - jQuery.print()
    </button>
    </div>
    <script src="./jquery-2.0.3.min.js"></script>

    <script src="../jQuery.print.js"></script>
    <script type='text/javascript'>
    //<![CDATA[
    jQuery(function($) { 'use strict';
    $("#ele2").find('.print-link').on('click', function() {
    //Print ele2 with default options
    $.print("#ele2");
    });
    $("#ele4").find('button').on('click', function() {
    //Print ele4 with custom options
    $("#ele4").print({
    //Use Global styles
    globalStyles : false,
    //Add link with attrbute media=print
    mediaPrint : false,
    //Custom stylesheet
    stylesheet : "http://fonts.googleapis.com/css?family=Inconsolata",
    //Print in a hidden iframe
    iframe : false,
    //Don't print this
    noPrintSelector : ".avoid-this",
    //Add this at top
    prepend : "Hello World!!!<br/>",
    //Add this on bottom
    append : "<br/>Buh Bye!",
    //Log to console when printing is done via a deffered callback
    deferred: $.Deferred().done(function() { console.log('Printing done', arguments); })
    });
    });
    // Fork https://github.com/sathvikp/jQuery.print for the full list of options
    });
    //]]>
    </script>
    </body>
    </html>

  • 相关阅读:
    汇编语言-子程序调用
    汇编语言-转移指令的原理
    汇编语言-直接定址表
    汇编语言-内中断
    汇编语言-汇编程序初识
    【Mybtais】Mybatis 插件 Plugin开发(一)动态代理步步解析
    【Redis】redis异步消息队列+Spring自定义注解+AOP方式实现系统日志持久化
    【ECharts】报表联动,动态数据设计
    【】POST、GET、RequestParam、ReqestBody、FormData、request payLoad简单认知
    【TensorFlow】Win7下使用Object Detection API 训练自己的数据集,并视频实时检测
  • 原文地址:https://www.cnblogs.com/simadongyang/p/9109627.html
Copyright © 2011-2022 走看看