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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Apr 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Printing 1 frame only

    I am new to Java Script. I am creating a web site with three frames. The first displays the banner, 2nd the nav bar, and the third is the main document layout.
    How do I specify that I want only the main frame to print and not the banner and the nav bar. I appreciate any help I can get!
    Thank you,
    Melissa

  • #2
    Regular Coder
    Join Date
    Apr 2003
    Location
    Atlanta, GA
    Posts
    487
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Truly, it's a function the user can override inside the print dialog -- but you can (in IE at least) do this:

    document.onbeforeprint = top.frames.mainFrame.focus;

    and it'll make the content frame the currently focused frame, to which the print dialog usually responds.

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Or you can put a print button in the main frame:

    <input type="button" value="Print" onclick="window.print()" />

    or a link

    <a href="#" onclick="window.print();return false">Print</a>

    You can use CSS to make them unprintable.

    <style type="text/css">
    @media print
    {
    .displayOnly {display: none;}
    }
    </style>
    ...
    <input type="button" value="Print" onclick="window.print()" class="displayOnly" />
    <a href="#" onclick="window.print();return false" class="displayOnly">Print</a>
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #4
    New to the CF scene
    Join Date
    Apr 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you so much!


  •  

    Posting Permissions

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