Jump to content

Don't Print Buttons - How?


MGLP
 Share

Recommended Posts

Example of how it might be done.

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

<style>
 @media only screen {
   body { color: green; }
   #prnButton { display: inline; }
 }
 @media only print {
   body { color: black; }
   #prnButton { display: none; }
 }
</style>
</head>
<body>

<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>

<script>
 function printpage() {
   window.print();  // logic to print the page
 }
</script>

</html>

 

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
 Share

×
×
  • Create New...