Breaking News

LightBlog

Thursday, 7 January 2016

Print Page Using Script

Html Code...........

<div Id="print">
        // Contain U Want to Print.......
</div>

<input id="Button1" type="button" onclick="print()" value="Print" />

Script Code..........

<script type="text/javascript">

        function PrintDiv() {
            var divToPrint = document.getElementById('print');
            var popupWin = window.open('', '_blank', 'width=300,height=400,location=no,left=200px');
            popupWin.document.open();
            popupWin.document.write('<html><body onload="window.print()">' + divToPrint.innerHTML + '</html>');
            popupWin.document.close();
        }
         </script>