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 打印图像

      时间:2023-10-01

      • <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 打印图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:有没有办法确定一个 &lt;select&gt;下拉菜单是否打开? 下一篇:在 chrome 下弹出一个窗口

                相关文章

              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>

                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>

                  1. <small id='FBlOX'></small><noframes id='FBlOX'>