saving and printing the results of an asp script

ginag used Ask the Experts™
I have a dynamic asp form which generates results based on input from users and is displayed within an html table.  I want to be able to save and print this form along with other forms which contain instructions.  The instructions are stored separtely in a doc format and html.  What is the easiest way to print a package for this dynamically generated form.  To all the experts out there thanks in advance for your input.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2006
You can print this page by simply having the body onload handler

<body onload="window.print()">

The instructions can be printed by opening those in another window. Again put onload even handler in the HTML page that you open. To open a new window use"Instructions.html", "Instructions"); If you want to combine both calls in one function, you can do that by ...

<script language="javascript">
function BodyOnLoad()
    var oInstructionWindow ="Instructions.html", "Instructions");
<body onload="BodyOnLoad()">

Users won't like this behavior though.


Thanks very much for the input - one question though - I'm not completly clear as to what you're referring to when you say users won't like this behavior.  Are you referring to opening another window with the instructions or combining the calls in one function??  If so in your experience - what would be the best way to handle this as the users want to be able to print the whole package combined??
Top Expert 2006

Yes. I was referring to opening another window just to print but if users don't want to click 2 links or navigate to 2 pages and then print, this might be the only alternative. You can try one more thing - to navigate the users automatically but for that you will need to put onbody handler in each page (even 'nstruction.htm). For example ...


<body onload="window.print();location.href='Instruction.htm">

This is your report page.



<body onload="window.print();">

This is your instruction page.


Again in this case the user will get 2 print boxes but it won't open 2 windows.


Say, thanks you've been very helpful- that gives me a direction to go in.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial