SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2003
    Stamford, CT, USA
    0 Post(s)
    0 Thread(s)

    Smile Print an alternate page


    My pages don't print well (the right side cut's off, etc) so I use an alternate printable page for each viewable page.

    I have the following in the viewable page:

    <link rel=alternate media=print href="printpage1.html">
    And then, on the printable page I have this:

        <script type='text/javascript'>
        window.onload = function () { window.blur(); window.print(); self.close(); }
    This works nicely, the user clicks on print, the alternate page opens in an invisible (i.e. small) window, prints itself and closes.

    The problem is that the printable page doesn't execute any js before it prints. So I can't use any document_writes() etc.

    For example, I have standard headers and footers that appear on every page. I use something like this:

    <SCRIPT LANGUAGE="JavaScript" type="text/javascript" src="footer.js"></SCRIPT>
    To insert the standard blocks.

    Is there a way I can get the page to execute some js before it prints?

    Thanks, Ed
    Last edited by Ed Hunter; Nov 10, 2003 at 12:08.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts