0

I have a "print this page" button that works fine:

<a style="top:-40;left: 375;position:absolute;z-index:5000;">
<script>
document.write("<input type='button' " +
"onClick='window.print()' " +
"class='printbutton' " +
"value='Print This Page'/>");
</script>
</a>

It is exactly where I want it and it doesn't show on the print.

I have several navigation buttons that jump to other pages:

<button style="position:absolute;top:1050px;left:-105px;z-index:5000;"> 
<a href="file:///C:/Users/jack/L-161%20Project/Rebuild/book/L-161%20Cover.html" target= "blank">Home</button></a>

These work fine, but they do print.

How can i make them not-print like the print button? I have tried several variations on modifying the print button script, but have not found the right combination yet.

Suggestions certainly appreciated. Please be very specific because I am very early into this.

jdanel
  • 3
  • 2

1 Answers1

0

You could do like suggested here.

Put this in your CSS file or add it to your style headers like you did with the "a" elements.

inside of a CSS document would look like this:

@media print
{    
    .no-print, .no-print *
    {
        display: none !important;
    }
}

Using inline-styles within your current document would look like this:

<style>
@media print
{    
    .no-print, .no-print *
    {
        display: none !important;
    }
}
</style>

then wrap your buttons in the no-print class.

<div-class="no-print">    
<button style="position:absolute;top:1050px;left:-105px;z-index:5000;"> 
<a href="file:///C:/Users/jack/L-161%20Project/Rebuild/book/L-161%20Cover.html" target= "blank">Home</button></a>
</div>
Community
  • 1
  • 1
xec86
  • 1,291
  • 1
  • 11
  • 17
  • Thank you xec86. What a nice and easy fix. I didn't want to add a div, so I put the class in – jdanel May 12 '16 at 20:28
  • You're welcome. If this helped you please mark it as a verified answer. It does help me build my reputation in the community. – xec86 May 12 '16 at 20:30