Print Preview using JavaScript onClick?

K

Kebmo

The client insists on having a link or button that the user can click
to view the printable version in the browser. I already have the css
done for the print version, so thats not a problem. I don't want to
create duplicate pages if I can help it (I anticipate many updates as
the months go by, and I don't want to have to do double the work).

I know I have seen this functionality before, but I can't seem to find
it now. Is there existing script to open the print preview pane with an
onClick?

Any help is greatly appreciated.

Kebmo
 
V

VK

Kebmo said:
The client insists on having a link or button that the user can click
to view the printable version in the browser. I already have the css
done for the print version, so thats not a problem. I don't want to
create duplicate pages if I can help it (I anticipate many updates as
the months go by, and I don't want to have to do double the work).

I know I have seen this functionality before, but I can't seem to find
it now. Is there existing script to open the print preview pane with an
onClick?

Any help is greatly appreciated.

Kebmo

In the document <head> : (no JavaScript needed)

<link rel="stylesheet"
type="text/css"
media="all"
href="stylesCommon.css">
<link rel="stylesheet"
type="text/css"
media="screen"
href="stylesBrowser.css">
<link rel="stylesheet"
type="text/css"
media="print"
href="stylesPrint.css">
 
K

Kebmo

Thanks. I have this sort of setup already. When the user prints the
page, it uses the print-only styledsheet I made for that purpose.

What I need is to be able to click a link or button and open the Print
Preview pane just as if I had gone to file-->print preview.

Is this even possible?
 
E

Evertjan.

Kebmo wrote on 27 okt 2005 in comp.lang.javascript:
Thanks. I have this sort of setup already. When the user prints the
page, it uses the print-only styledsheet I made for that purpose.

What I need is to be able to click a link or button and open the Print
Preview pane just as if I had gone to file-->print preview.

Is this even possible?

Using serverside jscript unser ASP:

<%@ Language=JScript %>
<link rel="stylesheet"
type="text/css"
media="all"
href="stylesCommon.css">

<link rel="stylesheet"
type="text/css"
media="screen"
<% ' ASP Jscript
if(request.querystring('print')=='yes'){
%>
href="stylesBrowser.css"
<%
}else{
%>
href="stylesPrint.css"
<%
};
%>
<link rel="stylesheet"
type="text/css"
media="print"
href="stylesPrint.css">

.......

<a href='?print=yes'>Print preview</a>
 
R

rf

Kebmo said:
The client insists on having a link or button that the user can click
to view the printable version in the browser.

Teach your client how to use File>Print Preview. Then she will stop wanting
that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top