码迷,mamicode.com
首页 > Web开发 > 详细

JS 打印图片

时间:2017-05-25 17:43:31      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:log   logs   技术分享   text   url   code   idt   javascrip   onclick   

在使用window.print()进行打印时,打印的内容可能会包含图片内容,此时的图片内容不能设置为背景图片,否则将无法再打印页面显示。

<!doctype html>
<html>
    <head>
        <title></title>
        <script type="text/javascript">
            function printfun(){
                window.print();
            }
        </script>
    </head>
    <body>
        <input type="button" value="打印" onclick="printfun()"><br/>
        下面设置的img图片:
        <div>
            <img src="images/moganna.png">
        </div>
        
        下面图片是背景图片:
        <div style="background: url(‘images/moganna.png‘); width: 500px; height: 291px;">
        
        </div>
    </body> 
</html>

技术分享  技术分享                                                                                                                   

 

JS 打印图片

标签:log   logs   技术分享   text   url   code   idt   javascrip   onclick   

原文地址:http://www.cnblogs.com/wind-wang/p/6905025.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!