Posts tagged ‘Print Html page’

Print Html page using javascript in asp.net

function printpage() {
//Get the print button and put it into a variable
var printButton = document.getElementById(“printbtn”);
//Set the print button visibility to ‘hidden’
printButton.style.visibility = ‘hidden’;
//Print the page content
window.print()
//Set the print button to ‘visible’ again
//[Delete this line if you want it to stay hidden after printing]
printButton.style.visibility = ‘visible’;
}

 

<input id=”printbtn” type=”button” value=”Print page” onclick=”printpage()”/>