Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Sep 2001
    Location
    San Jose, California, USA
    Posts
    92
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Supressing Javascript print (2002)

    Hi;

    I've snuck a Javascript menu (HVMenu) into top.htm so it appears as part of the banner in all my pages. Having to manually maintain top.htm is a small price to pay for having the menu nicely integrated into the site's look.

    Anyway, when pages are printed, the Javascript menu prints out of position. I know how flakey printing web pages can be, and this isn't a frequent problem, but it would be nice to omit it from printed pages since they are occasionally posted around the building.

    I've tried a media="print" style to omit the banner, but whether I put the noprint class in a top.htm <td> or <tr> tag, or in the <script> tags calling in the menu, it still appears when the page is printed. In the former, the noprint class works on the banner itself, just not the menu.

    Is there a reasonably simple way to prevent external Javascript from rendering on a print command?

    Here's hoping, <img src=/S/please.gif border=0 alt=please width=31 height=23>
    Dave

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Supressing Javascript print (2002)

    I think this problem was mulled on the web design board last year; perhaps it's even the same JavaScript code? Perhaps a glitch in its use of positioning.

    My impression is that the CSS2 support for media types is flaky. When MS converted the Knowledgebase to use it, my browser would unceremoniously close all of its windows when I tried to preview (or print from a preview, I forget the details). You'd think MS would know how not to crash its own browser!

    Sorry I don't have a quick fix... one thing I don't understand, though, do people typically print with a top frame showing??

  3. #3
    Star Lounger
    Join Date
    Sep 2001
    Location
    San Jose, California, USA
    Posts
    92
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Supressing Javascript print (2002)

    It's not in a frame, it's just the FrontPage top shared border. So hitting the browser print button prints the whole shebang. [img]/forums/images/smilies/ohmy.gif[/img])

    Dave

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Supressing Javascript print (2002)

    This code seems to work, but I'm not sure it's readily adaptable to your page:

    <html>
    <head>
    <style>
    @media screen {
    .logoC {display: inline}
    .logoP {display: none}
    }
    @media print {
    .logoC {display: none}
    .logoP {display: inline}
    }
    </style>
    </head>
    <body>


    Now you see two:

    </p>
    <hr>


    Now you see one (choose File>Print Preview and see a different one!):
    <span class="logoC"></span><span
    class="logoP"></span></p>
    </body>
    </html>

    The effect is illustrated in the attached (screen captures of page and page in preview window).
    Attached Images Attached Images

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Supressing Javascript print (2002)

    Okay, I figured out where HVMenu comes from (Dynamic Drive), and I think you might want to ask them what they suggest. I don't think this is a FrontPage-specific problem (not wanting to print the menus) so they might have a quick answer.

    In looking briefly at menu_com.js, it appears that you can target the MmbrCntnr object

  6. #6
    Star Lounger
    Join Date
    Sep 2001
    Location
    San Jose, California, USA
    Posts
    92
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Supressing Javascript print (2002)

    Thanks for the help. I'll see what I can do. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    Dave

Posting Permissions

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