print a page

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
micknic
Forum Commoner
Posts: 37
Joined: Thu Feb 27, 2003 1:27 pm
Location: belgium

print a page

Post by micknic »

Hi guys

I would like to automaticly print a page but i ythink its not possible with PHP. I think I'm going to use a macro. Could you tell me which software tu use and were to download it?? Of course it there is an other solution don't hesitate to advice me.

Thank you
craigh
Forum Newbie
Posts: 19
Joined: Sun May 19, 2002 2:50 pm

Post by craigh »

how about clicking the print button on the browser?
micknic
Forum Commoner
Posts: 37
Joined: Thu Feb 27, 2003 1:27 pm
Location: belgium

print a page

Post by micknic »

The problem is that i'm doing an web page for users who want to see a print button on the web page. I hope you can help me
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

unless you're using a trusted activeX-control for IE it's impossible.
spammich
Forum Newbie
Posts: 11
Joined: Sun Mar 23, 2003 12:40 am

Post by spammich »

Actually, it's pretty easy using javascript. Just create a button or link with an onclick event of window.print(). This will bring up the print dialog box.

Like this:

<input type="button" value="print" onclick="window.print();" />

You could also add window.print() to <body onload=""> and the print dialog will appear as soon as a page loads. This is very handy for forms/reports and stuff.

Of course, this has nothing to do with PHP.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

:?: with which browser is this working?
neither does my IE nor my mozilla do anything. But maybe I deactivated something...
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

very cool, thanks!
micknic
Forum Commoner
Posts: 37
Joined: Thu Feb 27, 2003 1:27 pm
Location: belgium

Post by micknic »

thanks for your help

Mickael :P
Post Reply