1. <tfoot id='fuZbw'></tfoot>
      <i id='fuZbw'><tr id='fuZbw'><dt id='fuZbw'><q id='fuZbw'><span id='fuZbw'><b id='fuZbw'><form id='fuZbw'><ins id='fuZbw'></ins><ul id='fuZbw'></ul><sub id='fuZbw'></sub></form><legend id='fuZbw'></legend><bdo id='fuZbw'><pre id='fuZbw'><center id='fuZbw'></center></pre></bdo></b><th id='fuZbw'></th></span></q></dt></tr></i><div id='fuZbw'><tfoot id='fuZbw'></tfoot><dl id='fuZbw'><fieldset id='fuZbw'></fieldset></dl></div>

      • <bdo id='fuZbw'></bdo><ul id='fuZbw'></ul>
      <legend id='fuZbw'><style id='fuZbw'><dir id='fuZbw'><q id='fuZbw'></q></dir></style></legend>

      <small id='fuZbw'></small><noframes id='fuZbw'>

      使用 javascript 打印图像

      Using javascript to print images(使用 javascript 打印图像)

      • <small id='uMSVr'></small><noframes id='uMSVr'>

        <tfoot id='uMSVr'></tfoot>
              <tbody id='uMSVr'></tbody>
            • <bdo id='uMSVr'></bdo><ul id='uMSVr'></ul>
              <i id='uMSVr'><tr id='uMSVr'><dt id='uMSVr'><q id='uMSVr'><span id='uMSVr'><b id='uMSVr'><form id='uMSVr'><ins id='uMSVr'></ins><ul id='uMSVr'></ul><sub id='uMSVr'></sub></form><legend id='uMSVr'></legend><bdo id='uMSVr'><pre id='uMSVr'><center id='uMSVr'></center></pre></bdo></b><th id='uMSVr'></th></span></q></dt></tr></i><div id='uMSVr'><tfoot id='uMSVr'></tfoot><dl id='uMSVr'><fieldset id='uMSVr'></fieldset></dl></div>
              <legend id='uMSVr'><style id='uMSVr'><dir id='uMSVr'><q id='uMSVr'></q></dir></style></legend>

                本文介绍了使用 javascript 打印图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我想知道是否可以使用 javascript 打开包含图像的弹出窗口,同时显示打印对话框.一旦有人点击打印,弹出窗口就会关闭.

                I would like to know if it's possible to use javascript to open a popup window containing an image, and at the same time have the print dialog show. Once someone clicks on print, the popup closes.

                这很容易实现吗?

                推荐答案

                另一个很棒的解决方案!!所有功劳归于 Codescratcher

                Another great solution!! All credit goes to Codescratcher

                <script>
                
                    function ImagetoPrint(source)
                    {
                        return "<html><head><scri"+"pt>function step1(){
                " +
                                "setTimeout('step2()', 10);}
                " +
                                "function step2(){window.print();window.close()}
                " +
                                "</scri" + "pt></head><body onload='step1()'>
                " +
                                "<img src='" + source + "' /></body></html>";
                    }
                
                    function PrintImage(source)
                    {
                        var Pagelink = "about:blank";
                        var pwa = window.open(Pagelink, "_new");
                        pwa.document.open();
                        pwa.document.write(ImagetoPrint(source));
                        pwa.document.close();
                    }
                
                </script>
                
                <a href="#" onclick="PrintImage('YOUR_IMAGE_PATH_HERE.JPG'); return false;">PRINT</a>
                

                查看完整示例这里.

                这篇关于使用 javascript 打印图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Fetch multiple links inside foreach loop(在 foreach 循环中获取多个链接)
                Backbone Fetch Request is OPTIONS method(Backbone Fetch Request 是 OPTIONS 方法)
                Fetch API leaks memory in Chrome(Fetch API 在 Chrome 中泄漏内存)
                How can I download and save a file using the Fetch API? (Node.js)(如何使用 Fetch API 下载和保存文件?(Node.js))
                Send blob data to node using fetch, multer, express(使用 fetch、multer、express 将 blob 数据发送到节点)
                Sending a custom User-Agent string along with my headers (fetch)(发送自定义用户代理字符串以及我的标头(获取))
              1. <i id='FBlOX'><tr id='FBlOX'><dt id='FBlOX'><q id='FBlOX'><span id='FBlOX'><b id='FBlOX'><form id='FBlOX'><ins id='FBlOX'></ins><ul id='FBlOX'></ul><sub id='FBlOX'></sub></form><legend id='FBlOX'></legend><bdo id='FBlOX'><pre id='FBlOX'><center id='FBlOX'></center></pre></bdo></b><th id='FBlOX'></th></span></q></dt></tr></i><div id='FBlOX'><tfoot id='FBlOX'></tfoot><dl id='FBlOX'><fieldset id='FBlOX'></fieldset></dl></div>
                    <tbody id='FBlOX'></tbody>

                1. <tfoot id='FBlOX'></tfoot>

                2. <legend id='FBlOX'><style id='FBlOX'><dir id='FBlOX'><q id='FBlOX'></q></dir></style></legend>
                    <bdo id='FBlOX'></bdo><ul id='FBlOX'></ul>

                        • <small id='FBlOX'></small><noframes id='FBlOX'>