Here is the way to print a part of a HTML, ASPX Form
<script language=JavaScript>
<!--
function printPartOfPage(elementId)
{
var printContent = document.getElementById(elementId);
var windowUrl = 'about:blank';
var uniqueName = new Date();
var windowName = 'Print' + uniqueName.getTime();
var printWindow = window.open(windowUrl, windowName, 'left=50000,top=50000,width=0,height=0');
printWindow.document.write(printContent.innerHTML);
printWindow.document.close();
printWindow.focus();
printWindow.print();
printWindow.close();
}
// -->
</script>
<div id="printDiv">
This is the content in the page to print
</div>
//////////////////////////
// To fire the event:
//////////////////////////
<input type="button" value="Print" onclick="JavaScript:printPartOfPage('printDiv');" >
This is the content in the page to print
<script language=JavaScript>
<!--
function printPartOfPage(elementId)
{
var printContent = document.getElementById(elementId);
var windowUrl = 'about:blank';
var uniqueName = new Date();
var windowName = 'Print' + uniqueName.getTime();
var printWindow = window.open(windowUrl, windowName, 'left=50000,top=50000,width=0,height=0');
printWindow.document.write(printContent.innerHTML);
printWindow.document.close();
printWindow.focus();
printWindow.print();
printWindow.close();
}
// -->
</script>
<div id="printDiv">
This is the content in the page to print
</div>
//////////////////////////
// To fire the event:
//////////////////////////
<input type="button" value="Print" onclick="JavaScript:printPartOfPage('printDiv');" >
Comments
Post a Comment