• mvc4 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>

  • 相关阅读:
    Day 03
    Day 03 作业
    Day 02 作业
    Day 02
    Day 01
    Day 10 面向对象基础
    Spring学习-- Bean 的作用域
    一、基本知识
    cloud-init使用技巧
    如何在KVM中管理存储池
  • 原文地址:https://www.cnblogs.com/Resources-blogs/p/6600978.html
Copyright © 2020-2023  润新知