Tilted Forum Project Discussion Community

Tilted Forum Project Discussion Community (https://thetfp.com/tfp/)
-   Tilted Technology (https://thetfp.com/tfp/tilted-technology/)
-   -   [html] Print script (https://thetfp.com/tfp/tilted-technology/73387-html-print-script.html)

feelgood 10-21-2004 08:16 AM

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

The question I have is that, will the print button show up on the printed page?

If not, is there a way for me to program a webpage using either html or jsp to print information from another page?

theFez 10-21-2004 08:43 AM

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.

Rawb 10-21-2004 10:40 AM

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.

noodles 10-21-2004 10:48 AM

Quote:

Originally Posted by aoeuhtns
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.

this is what i would suggest. once the button is clicked make the element invisible. simple, easy solution.

theFez 10-21-2004 05:12 PM

Quote:

Originally Posted by aoeuhtns
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.

any chance you could post some code to illustrate this? i've been learning css and have been very impressed with what can be accomplished.


All times are GMT -8. The time now is 06:11 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47