Magento: How to print div content only

To print div content only you can use the below sample script.


<!-- /* PG:  Code to print div content only */ -->
 
<script type="text/javascript">  
    function PrintDivOnly() {  
        var divToPrint = document.getElementById('divToPrint');
        var popupWin = window.open('', '_blank', 'width=400,height=400');
        popupWin.document.open();
        popupWin.document.write('<html><body onload="window.print()">' + divToPrint.innerHTML + '</html>');
        popupWin.document.close();
    }
</script>
 
<div id="divToPrint" ><h3>Div Content To Print</h3></div>

<div>
    <input type="button" value="Print Now" onclick="PrintDivOnly();" />
</div>
<!-- /* PG:  End: Code to print div content only */ -->

Note: You will know more about Magento & Download latest version of Magento from http://www.magentocommerce.com/
Magento: How to print div content only Magento: How to print div content only Reviewed by Web Technology Funda on 10:42:00 PM Rating: 5

No comments

Free! Free!Free! Subscribe to Get Free PHP (Magento) tutorial Update in Your Inbox!!! Hurry Up!!!