I don't want the navigation to be printed

195 views Asked by At

Hi I have build an Terms and Conditions sheet. (HTML) And added an print button. this one:

document.write("<input type='button' " +
"onClick='window.print()' " +
"class='printbutton' " +
"value='Print'/>");

Al good but when I print the page its also wants to print the navigation bar (ul)

How can i prefend that?

2

There are 2 answers

0
asjo On

Create a stylesheet for printing only (using a media="print" attribute on the style element), and set display: none on the elements you don't want to have printed.

0
XpDieto On

Thanx asjo. I will try that.

This is what worked for me.

<style type="text/css">

#printable { display: none; }

@media print
{
    #non-printable { display: none; }
    #printable { display: block; }
}
</style>

and then this:

<div id="non-printable">
    Your normal page contents
</div>

<div id="printable">
    Printer version
</div>

Basicly what asjo suggested.