Jquery 页面打印

<script src="~/Scripts/js/dist/jquery.jqprint-0.3.js"></script>

<script type="text/javascript">
    $(function () {
        
        function LoadPrintData()
        {
            $("#dttoexcel").show();
            $("#dttoexcel").jqprint();
            return false;
        }

        //页面打印功能
        $("#printBtn").click(function () {
            var Processid = $("#Process_PTR").children('option:selected').val();
            processName = $("#Process_PTR").children('option:selected').text();
            var begintime = $("#beginDate").val();
            var lasttime = $("#lastDate").val();
            $.ajax({
                type: "POST",
                url: '../Assay_BillMain/LoadAssayInfo',
                async: true,
                dataType: "text",
                error: function (request) {
                    alert("请先查出数据");
                },
                beforeSend: function () {
                    $("#dttoexcel").hide();
                    $("#exportBtn").attr({ "disabled": "disabled" });
                    $("#printBtn").attr({ "disabled": "disabled" });
                },
                success: function (data) {
                    $("#dttoexcel").show();
                    $("#dttoexcel").html(data);
                    LoadPrintData(data);
                    $("#dttoexcel").hide();
                    $("#exportBtn").removeAttr("disabled");//将按钮可用
                    $("#printBtn").removeAttr("disabled");//将按钮可用
                }
            });
            //防止Ajax页面提交后被刷新
            return false;
        });
    });

</script>

 
<button id="printBtn" role="button" class="btn btn-info btn-small">
      <i class="icon-print icon-white"></i> 打印
</button>

 

posted @ 2017-03-27 08:52  你也很优秀  阅读(536)  评论(0编辑  收藏  举报