473,772 Members | 2,388 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

style display:none and printing

Hi all,

Situation:
A (rather long) page that contains a lot of divs.
Some are visible (display:inline ) at a certain time, other not.

The javascript is responsible for divs to be visible or not.
Question:
If the browser is displaying some divs, and the user gives a printcommand
for the page, can I be sure only the visible parts are printed?

On my machine this is working fine (W2000/IE6), but I hope it will work on
all setups that support display:inline and display:none (= every modern
browser I think).

Could this give problems for different printers/printdrivers?
Or can I trust that if the browser can handle divs right, it will send the
correct commands to the printer?

(My problem is that the target environment (intranet somewhere) is somewhat
diverse.)

Any advise is very welcome. :-)

Regards,
Erwin Moller
Jan 4 '06 #1
3 2263


Erwin Moller wrote:

A (rather long) page that contains a lot of divs.
Some are visible (display:inline ) at a certain time, other not.

The javascript is responsible for divs to be visible or not.
Question:
If the browser is displaying some divs, and the user gives a printcommand
for the page, can I be sure only the visible parts are printed?

On my machine this is working fine (W2000/IE6), but I hope it will work on
all setups that support display:inline and display:none (= every modern
browser I think).


In general there could be a stylesheet or stylesheets for printing and
CSS rules for precedence and cascade should dictate whether what is
rendered on the screen is also printed that way.

And if you really need to know whether certain browsers print a document
in the state as currently manipulated with script or as initially loaded
you should run tests with those browsers.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 4 '06 #2

Erwin Moller napisal(a):
Hi all,

Situation:
A (rather long) page that contains a lot of divs.
Some are visible (display:inline ) at a certain time, other not.
That's an abuse. <div> is meant to be a block element (display: block),
and if you want a generic inline, use <span>. Theoretically there's
nothing wrong with that, and if you want it's legal to create <textarea
style="display: table-header-group"> but that's asking for trouble.
If the browser is displaying some divs, and the user gives a printcommand
for the page, can I be sure only the visible parts are printed?


If not, be sure to report a bug to the browser developers.
AFAIK there should be no problems. I never tried with inline DIVs
though.

Jan 4 '06 #3
bw****@gmail.co m wrote:

Erwin Moller napisal(a):
Hi all,

Situation:
A (rather long) page that contains a lot of divs.
Some are visible (display:inline ) at a certain time, other not.


That's an abuse. <div> is meant to be a block element (display: block),
and if you want a generic inline, use <span>. Theoretically there's
nothing wrong with that, and if you want it's legal to create <textarea
style="display: table-header-group"> but that's asking for trouble.
If the browser is displaying some divs, and the user gives a printcommand
for the page, can I be sure only the visible parts are printed?


If not, be sure to report a bug to the browser developers.
AFAIK there should be no problems. I never tried with inline DIVs
though.


Thanks both,

The display-style element in div is abuse?
OK, I believe that right away :-).
I am confortable with JS, but my stylesheetknowl edge sucks.
I'll change them to span's right away.

<textarea style="display: table-header-group">
LOL, nice nonsense. I got your point. ;-)

Ok, as far as the printerdrivers/printers/browser-combi's are concerned:
I'll hope the best of it, and just try it.
Untill now I didn't find a printer that screwed it up.

Regards,
Erwin Moller
Jan 5 '06 #4

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

Similar topics

13
40764
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div style="display:none"> can be displayed by setting the style attribute to "display:", or hidden with "display:none". This gives the illusion that the person filling out the form is switching from page to page...without the overhead of extra hits on the server,...
3
17797
by: David Lee | last post by:
I have some web pages on which I'd like to suppress certain items when printing. This is mostly working nicely: index.htm (here stripped to relevant essentials) has: <head> <link rel="stylesheet" href="style0.css" type="text/css"> <link rel="stylesheet" href="print0.css" type="text/css" media="print"> <head> <body>
2
8002
by: Erwin Moller | last post by:
Hi group, I have this obscure problem that really needs to be fixed, but I am out of ideas. Because the original script is very big, I'll try to summarize its functionality. Setup: - many form-elements that will 'activate' a part of the form based on the selection made.
2
9068
by: Jake Barnes | last post by:
Imagine I've this block of HTML: <p>Alex Schein Mailing List <input type="checkbox" name="newslettersToUse" value="133156"> (<a href="mcControlPanel.php" onClick="hideOrShowDivById('emailList133156'); return false;">See emails?</a>)</p> <form method="post" action="mcControlPanel.php" id="emailList133156" style="display:none;"><textarea name="formInputs">nazjeehaj@son.org,
6
29290
chunk1978
by: chunk1978 | last post by:
hi there... i'm about to embark on my very first PHP code journey (i've been saying that for a while... so sometime soon i hope... anyway)... before i begin my exciting new journey into PHP land, i would like to know if PHP will send hidden HTML form elements or not?... for example: if a user makes a selection in my HTML form that triggers my wonderfully dynamic HTML to set a DIV to STYLE="DISPLAY:NONE", is it possible to tell PHP not...
4
70093
by: gimme_this_gimme_that | last post by:
Hi, I have an onchange method for a select box that goes something like this (the select is in a form named aForm): function page_on_change() { pageElement = aForm.my_page_id; aForm.nav_page_name.value = pages.value]; var si = pageElement.selectedIndex;
4
1822
by: JonFSBrighton | last post by:
Hi there, I have recently joined this forum in the hope that someone could help me as I am going crazy! I have a form element within a hidden container, that uses the script.acluo.us SlideDown effect to slide down its container to reveal the form. The problem is that the form tags and attributes do not exist . . . . now I know this has something to do with style-display:none and that it removes it from the DOM . . . . . .but what ...
2
1552
hsriat
by: hsriat | last post by:
Maximum how many elements can be made hidden by giving STYLE={DISPLAY:NONE} in a single HTML file. Any restriction?... If it is there.. any way out as I want to make 110 rows with DISPLAY:NONE at a time..
2
3430
by: plsHelpMe | last post by:
Hi All, I am facing a weired issue. I am having a search form with some of the fields on it and a button which submits these fields values. Functionaly everything is working fine but sometimes when i try to submit my search form i can see the fields which are hidden using the style "display:none " visible for a moment just before my page is submitted. I am providing the html code behind those components as follows: <div class="formline...
0
9621
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10264
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10106
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10039
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8937
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7461
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4009
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.