Jump to content

Don't Print Buttons - How?


Recommended Posts

Example of how it might be done.

<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8" />
<title> Screen / Print Displays </title>

 @media only screen {
   body { color: green; }
   #prnButton { display: inline; }
 @media only print {
   body { color: black; }
   #prnButton { display: none; }

<h1>The @media Rule</h1>
<p>Use mediaqueries to set the text color to green 
<br>when the document is displayed on the screen, and to black when it is printed.</p>

<input id="prnButton" type='Button' value='Print' onclick='printpage()'> </body>

 function printpage() {
   window.print();  // logic to print the page



Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...