Monday, November 25, 2013

Print the page using javascript

<!DOCTYPE html>
<title>Print the page using javascript</title>
<!-- Begin
function varitext(){
var printContents = document.getElementById('printtext').innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
document.body.innerHTML = originalContents;
//  End -->
<!-- Remove header and footer text in the print page -->
@media print {
 @page { margin: 0; }
 body { margin: 1.6cm; }
border:1px solid #000;
.printtext-content .content-title{
text-align: center;
text-decoration: underline;
font-size: 24px;
<div >
<div id="printtext">
<div class="printtext-content">
<p><div class="content-title">SAYONARA</div></p>
As a number of you already know that today is my last day @IndiaNIC . It's hard to imagine that I won't be coming here from tomorrow. Things will be different, life won't be the same.
Everybody comes office to work , to gain knowledge , to make money  . but it;s the friends and colleagues who give me strength to come everyday at the same place and do the same thing again and again . i made life long friends @IndiaNIC, which is the only thing i cherish about.
I want you all to know that I am truly leaving here with mixed feelings; happy about my new career opportunity (really happy), but sad to be leaving such a wonderful friends and colleagues. The last   years as a member of IndiaNIC was the best period of my career so far.
<INPUT NAME="print" TYPE="button" VALUE="Print this Document!" ONCLICK="varitext()">

No comments:

Post a Comment