SitePoint Sponsor

User Tag List

Results 1 to 1 of 1

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    May 2003
    Location
    Stamford, CT, USA
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile Print an alternate page

    Hi,

    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:

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

    Code:
        <script type='text/javascript'>
        <!--
        window.onload = function () { window.blur(); window.print(); self.close(); }
        //-->
        </script>
    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:

    Code:
    <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 11:08.


Bookmarks

Posting Permissions

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