<script language="javascript" type="text/javascript">
function printDiv(divID) {
//Get the HTML of div
var divElements = document.getElementById(divID).innerHTML;
//Get the HTML of whole page
//var oldPage = document.body.innerHTML;
//Reset the page's HTML with div's HTML only
document.body.innerHTML =
"<html><head><title></title></head><body>" +
divElements + "</body>";
//Print Page
window.print();
//Restore orignal HTML
document.body.innerHTML = divElements;
}
</script>
<div id="aac">
Content
</div>
<input type="button" value="Print" style=" width:100px;height:28px; font-weight: bold; background-color:blue; color:White;" onclick="javascript: printDiv('aac')" />
function printDiv(divID) {
//Get the HTML of div
var divElements = document.getElementById(divID).innerHTML;
//Get the HTML of whole page
//var oldPage = document.body.innerHTML;
//Reset the page's HTML with div's HTML only
document.body.innerHTML =
"<html><head><title></title></head><body>" +
divElements + "</body>";
//Print Page
window.print();
//Restore orignal HTML
document.body.innerHTML = divElements;
}
</script>
<div id="aac">
Content
</div>
<input type="button" value="Print" style=" width:100px;height:28px; font-weight: bold; background-color:blue; color:White;" onclick="javascript: printDiv('aac')" />
No comments:
Post a Comment