Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
JavaScript
<script type="text/JavaScript">
     
     window.print()
     window.close()

   </script>

 <input type="button" value="Print"  önclick="this.style.visibility='hidden';window.print();" />


I am using this code webpage was printing but after printing i want to display old page it will contains buttons i.e print, save and Content

how it is displayed using java script code


Thanks &Regards
venky
Posted
Updated 5-Sep-21 17:13pm
v2
Comments
manognya kota 6-Feb-12 7:05am    
added <pre> tags.
Varun Sareen 6-Feb-12 7:07am    
Question not clear :(

<button class="btn btn-success " type="button" id="PrintData" ="finnish">PrintData</button>

$("#PrintData").click(function () {
var printButton = document.getElementById("savebtn");
var data = document.getElementById("printarea");
printButton.style.visibility = 'hidd
<pre><pre><big><big></big></big>
en';


window.print();
printButton.style.visibility = 'visible';


window.location.reload(true);



});
 
Share this answer
 
v2
Do you just mean you want the 'print' button (that you hid in its event handler) to come back again? If so, you need to give it an id, and then do:
document.getElementById("print_button").style.visibility = '';


(Note: I usually use .style.display instead, but I think that makes little difference.)

Or if you want it to come back immediately after window.print() is called you can inline it in the event handler:

<input type="button" value="Print"  önclick="this.style.visibility='hidden';window.print();this.style.visibility=''" />


However, this is all rather pointless since if you didn't provide the button at all, the user could just use the browser's Print button!

You can also use CSS to show/hide elements for printing, see for example this article[^].
 
Share this answer
 
Comments
thatraja 6-Feb-12 8:45am    
Right, 5!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900