[Javascript] Printing a Form
Scott Reynen
scott at randomchaos.com
Thu Apr 5 22:52:02 CDT 2007
On Apr 5, 2007, at 9:58 PM, Del Wegener wrote:
> Hi;
> I have a webpage that contains a form named "calculator' and a
> button which prints the page using onClick = "window.print()"
> The printed page then contains both the form and the button.
>
> I would like the visitor to be able to print just the form. Is
> that possible ? How do I do that?
You can do this with a print style sheet. In your HTML <body>, you
have something like this:
<input type="button" value="Print" onclick="window.print()" id="print-
button" />
In your HTML <head>, you need something like this:
<link rel="stylesheet" type"text/css" href="print.css" media="print" />
In print.css, you need something like this:
#print-button { display: none; }
Peace,
Scott
More information about the Javascript
mailing list