10-21-2004, 08:16 AM | #1 (permalink) |
Free Mars!
Location: I dunno, there's white people around me saying "eh" all the time
|
[html] Print script
I have 2 option of getting a particular webpage to be printed. 1 way is automatically and the other way is letting the user click on a button to print.
I don't want to use automaticallly since I want to let the user view the page before printing it. So, I'm considering using the following script for manual print button Code:
<SCRIPT LANGUAGE=JavaScript> <!-- Begin if (window.print) { document.write('<form>Do not forget to ' + '<input type=button name=print value="Print" ' + 'onClick="javascript:window.print()"> this page!</form>'); } // End --> </script> If not, is there a way for me to program a webpage using either html or jsp to print information from another page?
__________________
Looking out the window, that's an act of war. Staring at my shoes, that's an act of war. Committing an act of war? Oh you better believe that's an act of war Last edited by feelgood; 10-21-2004 at 08:21 AM.. |
10-21-2004, 08:43 AM | #2 (permalink) |
Crazy
Location: here and there
|
you could throw a dialog box to remind them to print the page.
function printPage() { if (window.print) { agree = confirm('This page contains really cool information that \nwe recommend you print a copy of at this time. \n\nOK to print now?'); if (agree) window.print(); } } you could then put a link to a printer friendly version of the page and onload execute the printPage() function. |
10-21-2004, 10:40 AM | #3 (permalink) |
Crazy
Location: Salt Town, UT
|
You can also eliminate the print button using css.
In css, a little used feature is to have different stylesheets for different media types. So, for example, in the print media type, you could set the print button to not display. Simple, easy, and doesn't require any client-side (or server-side) scripting. |
10-21-2004, 10:48 AM | #4 (permalink) | |
Psycho
Location: sc
|
Quote:
|
|
10-21-2004, 05:12 PM | #5 (permalink) | |
Crazy
Location: here and there
|
Quote:
|
|
Tags |
html, print, script |
|
|