![]() |
Hiding some jscript in Mozilla using media=print
Hi
I can hide the following code (that produces a slide out menu) from operating in IE but it does not work in Mozilla. Mozilla will hide text/tables etc but not the script below. Using .noprint {display: none} <div class=noprint><DIV style="LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px"> <SCRIPT language=JavaScript1.2 src="coolmenus4.js"> /************************************************** *************************** Copyright (c) 2001 Thomas Brattli ([email protected]) DHTML coolMenus - Get it at coolmenus.dhtmlcentral.com Version 4.0_beta ************************************************** ****************************/ </SCRIPT><script language="JavaScript1.2" src="makemenu.js"></script> <script language="JavaScript1.2" src="themenu2.js"></script> </DIV></div> Ideas anyone? |
What do you mean "hide the code"?
Do you mean you don't want the script to be included in the page? -- Joe (Microsoft MVP - XML) |
Hi
I mean when they go to print the print style sheet kicks in and says don't show the script which will maen the menu won't show in printing. Fine in IE. Mozilla acts as if the no print tag around the scripting does not exist. Cheers Chris |
Do you have a live example we can look at??
Imar |
Here is one that I am working on at present
http://www.esimplified.net/lifefmriverland/ Thanks Chris |
I did a quick check in IE, and it seems that it doesn't work correct there as well.
It's hiding the menu, but not the space it's occupying. display:none should hide the entire menu area, so your page's content should move to the left. Are you sure there is no parent element that you need to hide as well?? I am not sure how well FireFox deals with hiding stuff at print time that gets generated dynamically. I have successfully implemented printer friendly pages in both IE and FireFox, but none of them ad dynamic JavaScript for the menus. What happens when you hide stuff at an even higher level? body { display: none; } Does that work in FireFox? Cheers, Imar --------------------------------------- Imar Spaanjaars Everyone is unique, except for me. |
something interesting I didn't know you could do :-)
hoping to see some answers so I could use it. |
Well, it does work, in general, but not with this specific menu.
Check out this FAQ for a simple demonstration: http://Imar.Spaanjaars.Com/QuickDocId.aspx?QUICKDOC=240 Cheers, Imar |
Imar
This worked in Firefox body { display: none; } If I could just hide <script language="JavaScript1.2" src="themenu2.js"></script> Then it would soret it out...however I have tried every combination I can to hide the style menu with Firefox and have come to conclusion you can't but thanks for al the advice. In your helpful article at http://imar.spaanjaars.com/QuickDocId.aspx?QUICKDOC=240 Can you please clarify "You can use this trick in combination with a reversed, .PrintOnly class that only outputs stuff when the page is printed. This can be useful to display the full address of hyperlinks, for example." Thanks Chris |
Sure, that's easy.
In your normal style sheet add something like this: .PrintOnly { display: none; } This hides elements on your page when viewed on a normal screen / browser window. Use it like this: <div class="PrintOnly"> Hi, I am some content, but you won't be able to see me until you print the page I live on (or request a Print Preview to save the trees) </div> In your print style sheet (media="print") add something like this: .PrintOnly { display: block; border: 1px solid black; } Now, when the page is printed, the additional (hidden) div appears, showing its contents with a small black border (optional). Does this clarify things?? Cheers, Imar --------------------------------------- Imar Spaanjaars Everyone is unique, except for me. While typing this post, I was listening to: Sometimes It Snows In April by Prince and the Revolution (Track 12 from the album: Parade) What's This? |
| All times are GMT -4. The time now is 03:55 PM. |
Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.