Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

disabling-enabling printing

Status
Not open for further replies.

jazzmaster111

Programmer
May 2, 2005
25
0
0
MX
Hi:

I'm disabling the printing of a web page using this code:

<style type="text/css">

@media print { html, body { display: none; }}

</style>

How can I enable the printing on the same page by javascript?

Thanks!!
 
1) make two external css files, [tt]print.css[/tt] and [tt]noprint.css[/tt]

noprint.css:
Code:
html, body { display: none; }

print.css:
Code:
html, body { display: inherit; }

2) initially include the non-printing file, like this:
Code:
<link rel="stylesheet" href="noprint.css" type="text/css" id="mySS">

3) have a link or button with this type of code:
Code:
<a href="#" onclick="document.getElementById('mySS').href = 'print.css'; return false;">Make Printable</a>

*cLFlaVA
----------------------------
[tt]your mom goes to college[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top