473,549 Members | 3,127 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hiding a Javascript menu from printing with CSS

Hi,

I have set up an external stylesheet, named "print.css" , to format the
style of all pages printed from my company's website. I've been
previewing my changes to the stylesheet by doing File\Print Preview in
IE6 and noticed that occasionally the leftmost button of the
javascript menu (CoolMenus Version 3.02) on our website is printed. (I
have wrapped the javascript that generates this menu in a DIV so that
it is concealed from printing via the print.css stylesheet)

It took me a while to work out what the actual cause of this problem
was; the occurrence of the leftmost button of our javascript menu
seemed so random. What's happening is that, by chance, when you
navigate to Print Preview under the File menu in IE, the mouse often
ends up directly over the top of the leftmost button of the javascript
menu, triggering momentarily the mouseover for that menu item which in
turn includes it in the print preview. i.e. it bypasses the
display="none" instruction set up in the print.css, printing the
literal snapshot of the page.

I've had some luck by adding a class="noprint" to the imgs and divs
within the javascript code, but this does not remove the entire menu.
My knowledge of Javascript is very scratchy. Can anyone suggest how I
can modify the code to conceal the entire menu upon printing?

i.e. do i need to more than just wrapping the reference (in the html
pages) to the javascript menu in DIVs?

Many thanks in advance,

Rob.
Jul 20 '05 #1
8 3239
Rob McLennan - ZETLAND wrote:
I have set up an external stylesheet, named "print.css" , to format the
style of all pages printed from my company's website. I've been
previewing my changes to the stylesheet by doing File\Print Preview in
IE6 and noticed that occasionally the leftmost button of the
javascript menu (CoolMenus Version 3.02) on our website is printed.


If you have this site on the web (as opposed to an intranet for example)
you have bigger problems than printen a button occasionally. Making your
navigation menu *depend* on JavaScript is not such a good idea. Many
visitors may not have JavaScript able browsers. One of those visitors,
with no JavaScript possibilities, is Google.

If you put up a URL, we can take a look at the problem and try to help
you solve it.

--

Barbara

http://home.wanadoo.nl/b.de.zoete/html/weblog.html
http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html

Jul 20 '05 #2
Barbara de Zoete <b_********@hot mail.com> wrote in message news:<c0******* ******@ID-52872.news.uni-berlin.de>...
Rob McLennan - ZETLAND wrote:
I have set up an external stylesheet, named "print.css" , to format the
style of all pages printed from my company's website. I've been
previewing my changes to the stylesheet by doing File\Print Preview in
IE6 and noticed that occasionally the leftmost button of the
javascript menu (CoolMenus Version 3.02) on our website is printed.
If you have this site on the web (as opposed to an intranet for example)
you have bigger problems than printen a button occasionally. Making your
navigation menu *depend* on JavaScript is not such a good idea. Many
visitors may not have JavaScript able browsers. One of those visitors,
with no JavaScript possibilities, is Google.


Which then do you think is the best method for building a main navigation menu?

If you put up a URL, we can take a look at the problem and try to help
you solve it.

Jul 20 '05 #3
"Rob McLennan - ZETLAND" <ro*****@hotmai l.com> wrote in message
news:72******** *************** ***@posting.goo gle.com...
Barbara de Zoete <b_********@hot mail.com> wrote in message news:<c0******* ******@ID-52872.news.uni-berlin.de>...
Rob McLennan - ZETLAND wrote:
I have set up an external stylesheet, named "print.css" , to format the
style of all pages printed from my company's website. I've been
previewing my changes to the stylesheet by doing File\Print Preview in
IE6 and noticed that occasionally the leftmost button of the
javascript menu (CoolMenus Version 3.02) on our website is printed.


If you have this site on the web (as opposed to an intranet for example)
you have bigger problems than printen a button occasionally. Making your
navigation menu *depend* on JavaScript is not such a good idea. Many
visitors may not have JavaScript able browsers. One of those visitors,
with no JavaScript possibilities, is Google.


Which then do you think is the best method for building a main navigation

menu?

Several options are better than using JavaScript to generate your
navigation. Static HTML, though cumbersome to update on every page of you
site, would be better because then search engines could at least index those
pages (and people with JavaScript turned off could get to them as well).
JavaScript should only be used for "extra" bells and whistles, and should
not be considered reliable.

You could look into doing server side includes (putting your nav in that
file and then including that file in all of your pages), or other server
side processing to create the navigation (like ASP, PHP, etc.).

If you put up a URL, we can take a look at the problem and try to help
you solve it.


You forgot a link.
Regards,
Peter Foti
Jul 20 '05 #4
Rob McLennan - ZETLAND wrote:
Barbara de Zoete <b_********@hot mail.com> wrote in message news:<c0******* ******@ID-52872.news.uni-berlin.de>...
Rob McLennan - ZETLAND wrote:


Which then do you think is the best method for building a main navigation menu?


Same as all of the rest of your side. Build pages in clean markup. Make
sure it works in various browsers and that it validates. Then add styles
with CSS, preferably with an external stylesheet. Then add JavaScript
for even more effects.
If you follow this order, proper markup > styles > scripts and other
effects, your site will work well in numerous browsers on various
platforms. Besides that, if you actually have some content too, Google
will love you.
If you put up a URL, we can take a look at the problem and try to help
you solve it.


How about that URL now than?

--

Barbara

http://home.wanadoo.nl/b.de.zoete/html/weblog.html
http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html

Jul 20 '05 #5
Barbara de Zoete <b_********@hot mail.com> wrote in message news:<c1******* ******@ID-52872.news.uni-berlin.de>...
Rob McLennan - ZETLAND wrote:
Barbara de Zoete <b_********@hot mail.com> wrote in message news:<c0******* ******@ID-52872.news.uni-berlin.de>...
Rob McLennan - ZETLAND wrote:


Which then do you think is the best method for building a main navigation menu?


Same as all of the rest of your side. Build pages in clean markup. Make
sure it works in various browsers and that it validates. Then add styles
with CSS, preferably with an external stylesheet. Then add JavaScript
for even more effects.
If you follow this order, proper markup > styles > scripts and other
effects, your site will work well in numerous browsers on various
platforms. Besides that, if you actually have some content too, Google
will love you.
If you put up a URL, we can take a look at the problem and try to help
you solve it.


How about that URL now than?


Sorry about the delay! Here it is (finally):

http://www.objective.com/

Yeah, this all sounds good to me. I came into this company after the
site was built, but they'll be revamping it soon so I'm very
interested in setting it up properly. I'm not overly happy with the
fact that, as you can see, the navigation is in a separate frame, as
part of an overall frameset. I'm sure you know the reasons why I want
to ditch the frames altogether :)

I like the idea, that Peter Foti mentions, of using SSI, which is
something I've started doing already for other parts of the site.
However, I'd also like to preserve the main nav bar being visible at
all times, as it is now.

I like the idea of using clean html, but how do I preserve the complex
rollovers that are currently there, if not with javascript? Wouldn't
this mean dynamic html, using divs/layers? If so, I have a bit of an
issue with browser interpretation of divs.
Jul 20 '05 #6
Els


Rob McLennan - ZETLAND wrote:
Sorry about the delay! Here it is (finally):

http://www.objective.com/


I just had a look at the site in NS7.1:
when you click an item on the top menu (green), the whole
pictures falls down on the requested page, hiding the top of
the content. Only on Overview and Locations the picture and
menu stay where they belong.

I just checked in IE6.0 to see if it has the same problem,
and it has not. But I discovered that there is another menu
on top of the picture, it's blue and has drop down menu when
moused over. That menu isn't there at all in NS7.1 :-)

--
Els

Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -

Jul 20 '05 #7

Rob McLennan - ZETLAND wrote:
Barbara de Zoete <b_********@hot mail.com> wrote in message news:<c1******* ******@ID-52872.news.uni-berlin.de>...
How about that URL now than?
Sorry about the delay! Here it is (finally):

http://www.objective.com/

I like the idea, that Peter Foti mentions, of using SSI,


If you can use it and know how to, it is a good thing.
However, I'd also like to preserve the main nav bar being visible at
all times, as it is now.
In Dutch, but if you look at the markup and styles you'll find out how
it's done, see
<http://home.wanadoo.nl/b.de.zoete/voorbeelden/voorbeeld_fixer en-kop.html>
for how to simulate frames. Works fine in IE.
I like the idea of using clean html, but how do I preserve the complex
rollovers that are currently there, if not with javascript?
Dutch also, see
<http://home.wanadoo.nl/b.de.zoete/voorbeelden/voorbeeld_menu-met-hovereffect.htm l>
for various menu's with some effects when hovered. All no JavaScript.The
pop-out menu doesn't work in IE. Have not yet solved that.
Wouldn't
this mean dynamic html, using divs/layers? If so, I have a bit of an
issue with browser interpretation of divs.


My guess is the current site has much bigger issues than rendering divs
correctly, like the heavy scripting used for a simple nav-menu in the
top frame and the lack of appropriate alt-texts with the images,
especially those used for navigation. This is no good.
Besides that, the site seems to work in IE6, but it definately does not
work in Netscape7 (nav-menu, the one you think is valuable enough to
keep on screen always, doesn't show).

--

Barbara

http://home.wanadoo.nl/b.de.zoete/html/weblog.html
http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html

Jul 20 '05 #8
On 23 Feb 2004 18:03:59 -0800, ro*****@hotmail .com (Rob McLennan -
ZETLAND) wrote:
I like the idea, that Peter Foti mentions, of using SSI, which is
something I've started doing already for other parts of the site.
However, I'd also like to preserve the main nav bar being visible at
all times, as it is now.


Unless you have a very specific reason for using SSI, I'd be inclined to
recommend PHP. Includes in PHP are as simple as:

<?php
include ('pageheader.tx t');
include ('menu.txt');
?>

but you can do very much more than SSI if you later find you need to.

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Jul 20 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4662
by: Rob McLennan - ZETLAND | last post by:
Hi, I have set up an external stylesheet, named "print.css", to format the style of all pages printed from my company's website. I've been previewing my changes to the stylesheet by doing File\Print Preview in IE6 and noticed that occasionally the leftmost button of the javascript menu (CoolMenus Version 3.02) on our website is printed. (I...
7
1665
by: e | last post by:
I've been having an extremely difficult time finding an answer to this in IE / js groups, so I thought I'd try here. I've got an aspx page that delivers loads of report data into custom-named <span> tags on the client, hidden from the screen by @media classes. From a dynamically built menu of what was returned, the user selects wich report...
2
2251
by: Rosanne | last post by:
I have a menu written in javascript. I include that menu on an asp page. The aspx page contains both a listbox and a datagrid. There i one drop down menu that overlaps the place where the listbox is. Whe the user hovers over the drop down menu, the listbox hides the botto options on the menu. However, the menu also overlaps the place wher...
6
2114
by: J Ames | last post by:
I have an ASP.NET (VB) form that has two drop downs, a horizontal rule and a button. The button invokes a stored procedure and several tables are created on the page with data populated. I want to create a link to print the page, but I don't want the drop downs or the button to print, only the tables. How can this be done? I know how to...
2
1366
by: vivekian | last post by:
Hi, I have a webpage where on the left side have a menu and on clicking the different rows in the menu, different content needs to show up on the right side. This all has to in a single web page. I suppose this can be done using name anchors but would like to hide the rest of the content and only show what is relevant depending on the row...
3
1944
by: Andy Lim | last post by:
Hi all, In my recent asp.net (2.0) project, I want to give a desktop-application look and feel to my users. I think I'll do it by hiding the browser's default menu & toolbar right from the default page (i.e: default.aspx), which also serve as my login page. And it should have cross-browsers capability. Can anyone give me some examples on...
3
4217
by: Jlcarroll | last post by:
Hi, I am building a web page.and have a simple javascript menu... I call the javascript menu within a div block that my print sytlesheet has set as a display: none;, well all the content in that block doesn't show up, EXCEPT the javascript is still getting run... <div class="menu"> <!--*****************These lines load in the
1
1180
by: agtalpai | last post by:
Hi there, my problem is the following: I'd like to hide certain parts of a site using javascript; and I want to use it as a cycle (eg: first click - header div disappearance; second click - menu disappearance; third click - content disappearance; fourth click - show all divas again); I have a content like (simplified): <html> <head>...
0
7520
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7446
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7718
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7956
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7470
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6041
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5088
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1058
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.