Jump to content

Print


dizzy1

Recommended Posts

Hi all i want to do is print another page

 

Im on one page click a button which passes variables accross:

 

<a href="PersonReportPrint.php?PersonID=1&Module=<?=$ModuleNo;?>&Tyear=<?=$Tyear;?>">

 

 

On the other page i have <body onLoad="window.print()">

 

which opens the print dialogue BUT it also opens that page PersonReportPrint.php when all i want is for that page to print.

Link to comment
Share on other sites

You could try onLoad='window.print();window.close();' but for that to work the window would have to have been opened by a script in the first place (in firefox at least, not sure about ie), so you'd have to use something like <a onclick='window.open(your url)'> rather than <a href=...>

 

I'd find that behaviour fairly annoying if I was using it though...

Link to comment
Share on other sites

You could try onLoad='window.print();window.close();' but for that to work the window would have to have been opened by a script in the first place (in firefox at least, not sure about ie), so you'd have to use something like <a onclick='window.open(your url)'> rather than <a href=...>

 

I'd find that behaviour fairly annoying if I was using it though...

 

Ill try it see how annoyin it is, thanks.

Link to comment
Share on other sites

right ive added teh code so it opens in it own small window BUT when i do this

 

echo"<body onLoad='window.print()window.close();'>"; 

 

It Does Nothing If i Do this

 

echo"<body onLoad='window.print()'>"; 

 

IT PRINTS OR

 

echo"<body onLoad='window.close();'>";

 

IT Closed the window straight away.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.