Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Dec 2007
    Location
    SoCal
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    printing multiple separate web pages

    Following fuction attempts to load and print 9 web pages in sequential order. How do I force next sequential page load/focus/print to occur only after previous page has loaded and printing has completed? Is there a way to detect and wait until print() step has ended before proceeding with the next web page?

    <script language="javascript">
    <!--
    function printL01() {
    alert('A Total of 9 Web Pages will be Printed!');
    window.parent.tspstdleft.location="pdf01note01.htm";
    window.parent.tspstdleft.focus();
    window.parent.tspstdleft.print();

    window.parent.tspstdleft.location="pdf01note02.htm";
    window.parent.tspstdleft.focus();
    window.parent.tspstdleft.print();

    window.parent.tspstdleft.location="pdf01note03.htm";
    window.parent.tspstdleft.focus();
    window.parent.tspstdleft.print();

    window.parent.tspstdleft.location="pdf01note04.htm";
    window.parent.tspstdleft.focus();
    window.parent.tspstdleft.print();

    window.parent.tspstdleft.location="pdf01note05.htm";
    window.parent.tspstdleft.focus();
    window.parent.tspstdleft.print();

    window.parent.tspstdleft.location="pdf01note06.htm";
    window.parent.tspstdleft.focus();
    window.parent.tspstdleft.print();

    window.parent.tspstdleft.location="pdf01note07.htm";
    window.parent.tspstdleft.focus();
    window.parent.tspstdleft.print();

    window.parent.tspstdleft.location="pdf01exam01.htm";
    window.parent.tspstdleft.focus();
    window.parent.tspstdleft.print();

    window.parent.tspstdleft.location="pdf01exam02.htm";
    window.parent.tspstdleft.focus();
    window.parent.tspstdleft.print();

    window.parent.tspstdleft.location="pdf00start.htm";
    }
    // End -->
    </script>

  • #2
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    you could add an onload handler but, you can never know if the user accepted the print :/
    You never have to change anything you got up in the middle of the night to write. -- Saul Bellow

  • #3
    New Coder
    Join Date
    Dec 2007
    Location
    SoCal
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    onload handler

    Thanks. I think this may be a solution for me. I have created a printframe.htm frames page that onload executes fillFrame() script to load the requested page that I want to print. It looks like this:

    <html>
    <head>
    <script language="JavaScript">
    <!--Begin
    var default_page = "stdformsmain.htm";
    var content = (location.search) ? location.search.substring(1,location.search.length) : default_page;

    function fillFrame() {
    url=content
    parent.stdprintframemain.location.href=url
    }
    function printPage() {
    window.parent.stdprintframemain.focus();
    window.parent.stdprintframemain.print();
    }
    // End -->
    </script>

    <script language="javascript">
    <!--
    function closePage() {
    top.window.opener=top;
    top.window.open('','_parent','');
    top.window.close();
    }
    // End -->
    </script>



    </head>

    <frameset rows="24,*" onLoad="fillFrame()";>
    <frame name="stdprintframeheader" scrolling="no" noresize target="stdprintframemain" src="stdprintbanner.htm" marginwidth="1" marginheight="1">
    <frame name="stdprintframemain" marginwidth="1" marginheight="1" scrolling="auto" src="stdprintmain.htm" noresize>
    <noframes>
    <body>
    <p>This page uses frames, but your browser doesn't support them.</p>


    </noframes>

    </frameset>
    </body>

    </html>

    Right now the banner frame on top provides buttons that will execute a printPage() script to print the loaded page and a closePage() script that will close the frames page parent window. Can I make this automatic? How do I call all three functions: fillFrame();printPage();closePage() sequentially one after the other as part of the onLoad event? Is there an onLoad handler variation that will let me do this? If I can do this I don't need the user to click the print and close buttons in the banner...

  • #4
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Why don't you just generate one document to print? Seems like it would be a lot user friendly.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #5
    New Coder
    Join Date
    Dec 2007
    Location
    SoCal
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    onLoad Handler multiple events

    I need to give my users the opportunity to print selected pages from a library file one at a time. Once he has selected the page I want to do 3 JS tasks in the onload handler: fillFrame();printPage();closePage(). How do I keep the onload handler from trying to execute these 3 tasks all at once?


  •  

    Posting Permissions

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