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 9 of 9
  1. #1
    Regular Coder
    Join Date
    Sep 2002
    Location
    Bugaha, NE
    Posts
    330
    Thanks
    0
    Thanked 0 Times in 0 Posts

    using javascript to print a page...

    I hate frames. Have I mentioned that? I inherited a site in my new job that uses them. While I'm re-writing it using ASP include files, in the meantime I need to be able to support it in frames. The plus side is I'm learning quite a bit of javascript, and how to get around in the frames...


    Anway, my question:

    My users need to be able toi print all 3 frames, or at least two of them, with it looking like one document. By going thru file-->print, only the active frame is printed. Likewise, by right-clicking on a frame, only that one gets printed, as is the same when I use



    javascript:window.print

    Anyone got any ideas how to print all of the frames appearing?


    Thanks...

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    javascript: top.print();

  • #3
    Regular Coder
    Join Date
    Sep 2002
    Location
    Bugaha, NE
    Posts
    330
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That prints the frame that you put that in, but I'm looking for a way to print all frames that are displayed with one link.

    Any ideas?


    Thanks.

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by BigDaddy
    That prints the frame that you put that in, but I'm looking for a way to print all frames that are displayed with one link.

    Any ideas?


    Thanks.
    top.print() should print all the frames. top references the "top" window which holds the frameset. window.print() is the reference for printing only the current frame since that references only the local frame's window object.

  • #5
    Regular Coder
    Join Date
    Sep 2002
    Location
    Bugaha, NE
    Posts
    330
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It doesn't work. Perhaps it's because I'm using a nested framset, but here is the structure:

    <frameset rows='130,450,25' frameborder='no' >
    <frame src='TopFrame.asp' name='top_content' >
    <frameset cols='22%,*' >
    <frame src='navigation.asp' name='nav'>
    <frame src='MainFrame.asp' name='content' >
    </frameset>")
    <frame src=MarqueeList2.asp' name='marquee'>")
    </frameset>


    I tried putting the link to print in pages in the top_content, nav, and content frames, and only the frame it was in would print. I need to print all 3 at one time with one command, making it look like no frames were used.

    I appreciate the help.

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Posts
    676
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Originally posted by BigDaddy
    </frameset>")
    <frame src=MarqueeList2.asp' name='marquee'>")
    /me just a whispers® to big...
    ummm howww come you have those bolded parts in the coding???mayyybe thattts whats just a messing® it up??? /me doesnt see where ya just a opened® them...??? aka ("
    orrr as just a nother® suggestion...
    do you have these 'pages' in like 'doc' form??? you could have just a link® to print this 'page' 'cept it twould be printing just a nother® file made up of the information the viewer is looking @ when they just a click® the 'print' button???

  • #7
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Good catch, Steph, although I don't *think* that's the problem. But for some reason that looks familiar.

    top.print() ? Never tried it because I abhor frames... but as you know, I love messing around with stuff until it works.
    Last edited by whammy; 01-21-2003 at 02:45 AM.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Posts
    676
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Originally posted by whammy
    Good catch, Steph, although I don't *think* that's the

    ...as you know, I love messing around with stuff until it works. :D
    ya mean it didnt just a belong® there??? hehehe...

    n' rotflmao!!! ifin' he wants this to just a work® in netscrap tooo...hehehe...n' rememberin' alll the whaaaaaa's /me sent ya trying to make the ol' db just a netscrap® friendly...:O)))

  • #9
    Regular Coder
    Join Date
    Sep 2002
    Location
    Bugaha, NE
    Posts
    330
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nah, guys. The guy before me had set up the page to check browser version, and had used javascript to write out the framesets using document.write(" "). I deleted that stuff, will probably add it back in, but was troubleshooting it without it. I guess I missed a couple when posting here.


    Anyway, I tried putting a function in the top page, index, where the framesets are declared. In the function was just a simple javascript:window.print(), which I tried calling from each of the 3 windows. That did nothing but print one frame.


    Thankis for all your suggestions, guys. I might have to just tell them to get used to right-clicking and printing until I can roll out a new no-frames site, which is currently in production.
    Last edited by BigDaddy; 01-21-2003 at 03:26 PM.


  •  

    Posting Permissions

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