Thursday, February 16, 2012

Hide part webpage when the webpage was printing

PrintForm = function (strid)
{
var prtContent = document.getElementById(strid);
var WinPrint = window.open('', '', 'letf=0,top=0,width=480,height=400,toolbar=0,scrollbars=0,status=0');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
prtContent.innerHTML = strOldOne;
}
Here’s the webpage, the printable area must be inside a div:
<div id="divPrint">
SAMPLE CONTENT
</div>

<input id="btnPrintBottom" type="button" value="Print" onclick="PrintForm('divPrint')" />

Print button hiding:
document.getElementById('Button').style.visibility = "hidden";
Display TextBox data into Label :
var b = document.getElementById('<%=TextBox1.ClientID %>').value;
document.getElementById('lb').style.display = "block";
var c = document.getElementById('<%=lblName.ClientID %>').innerText= b.toString();

No comments:

Post a Comment