JS 打印圖片


在使用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>

                                                                                                                    

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM