i am new to javascipt and i want to print a selected area of the asp page to print through javascript ...is there any solution plz guide
hide items for print
Collapse
X
-
Easiest way to acomplish this is to make a 'print-only' style sheet. This means that you make a CSS sheet and include that in your script with e.g.
[html]<link rel="stylesheet " media="print" type="text/css" href="noprt.css " />[/html].
Take notice of the media="print" attribute. This stylesheet will be used by default whenever you print.
Within the style sheet you can define, for example a class [html].nopr { display:none; }[/html].
When you define that class in all elements that you do not want to be printed, (class="nopr") you will only print those parts of the screen that you want.
Ronald :cool:Comment
-
hide items for print
sir i want to print a report that is in an html page i have made a button that calls the javascript function window.print for e.g.
<td class="table">< input type="button" name="Print1" value="Print1" onClick="javasc ript:window.pri nt()"></td>
now when it prints it prints the whole page including the print and logout buttons that are at the end of the page ....now how can i ommit those 2 buttons in print ...can any body help meComment
-
-
[HTML]<!-- Paste this code into the STYLE section of your HTML document
so the button itself will not print -->
@media print {
input.noPrint { display: none; }
}
<!-- Paste this code into the BODY section of your HTML document -->
<input class="noPrint" type="button" value="Print This Page" onclick="window .print()">[/HTML]Comment
Comment