首页 > 代码库 > jquery 浏览器打印

jquery 浏览器打印

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <script src=http://www.mamicode.com/"Scripts/jquery-1.10.2.js"></script>
    <script src=http://www.mamicode.com/"Scripts/jquery.PrintArea.js"></script>
    <script type="text/javascript">
        $(function () {
            //打印
            $("#btnPrint").bind("click", function (event) {
                $("#myPrintArea").printArea();
            });
           
        })
    </script>
</head>
<body>
    <div id="myPrintArea">
        <div>.....文本打印部分.....</div>
        <div>
            <table>
                <tr>
                    <td>这是一张表</td>
                    <td>这是一张表</td>
                </tr>
                <tr>
                    <td>这是一张表</td>
                    <td>这是一张表</td>
                </tr>
            </table>

        </div>
    </div>
    <div class="quote_title">引用</div><div class="quote_div"></div> 
    <input type=button class="noprint" id="btnPrint" value=http://www.mamicode.com/" 打 印 "> <!--onclick=javascript:window.print()-->
</body>
</html>

 

jquery 浏览器打印