473,756 Members | 3,973 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: How to implement a mask of visibility/invisibility of a set of<div> elements?

Wow... this post is pretty unreadable. Ok, i'll try to make it
simpler:

I've got this first page:
-----------------------------------------------------------
<div id=1>some text here</div>
<div id=2 style="display: none;"some text here</div>
<div id=3another text here </div>
<div id=4 style="display: none;">text here:
<div id=4.1>one comment </div>
<div id=4.2>another comment </div>
</div>
<div id=5 style="display: none"some text </div>
-----------------------------------------------------------
divs 1 and 3 are visible
divs 2, 4 and 5 are hidden (and 4.1, 4.2 too as they're 4's children).
This page is the reference in terms of visibility of divs.

Now, let's say I have another page, like this one:
-----------------------------------------------------------
<div id=1>some text here</div>
<div id=2some text here</div>
<div id=3another text here </div>
<div id=4>text here:
<div id=4.1>one comment </div>
<div id=4.2>another comment </div>
<div id=4.3>yet another comment </div>
</div>
<div id=5some text </div>
<div id=6a new div here with some text!!! </div>
-----------------------------------------------------------
This page is somehow the same but not really because:
- All divs are visible
- the div 4.3 have been added
- the div 6 is new too

OK?
Now the question is:
For this second page, considering my reference page, how could I
programmaticall y:
-let divs 1 and 3 visible
-hide divs 2, 4, 5 ( and all children divs of 4)
-hide div 6 too.

Thanks for all kind of suggestions.

Num,

Nov 18 '08 #1
1 1911
Num GG wrote:
Wow... this post is pretty unreadable. Ok, i'll try to make it
simpler:

I've got this first page:
-----------------------------------------------------------
<div id=1>some text here</div>
<div id=2 style="display: none;"some text here</div>
<div id=3another text here </div>
<div id=4 style="display: none;">text here:
<div id=4.1>one comment </div>
<div id=4.2>another comment </div>
</div>
<div id=5 style="display: none"some text </div>
-----------------------------------------------------------
divs 1 and 3 are visible
divs 2, 4 and 5 are hidden (and 4.1, 4.2 too as they're 4's children).
This page is the reference in terms of visibility of divs.

Now, let's say I have another page, like this one:
-----------------------------------------------------------
<div id=1>some text here</div>
<div id=2some text here</div>
<div id=3another text here </div>
<div id=4>text here:
<div id=4.1>one comment </div>
<div id=4.2>another comment </div>
<div id=4.3>yet another comment </div>
</div>
<div id=5some text </div>
<div id=6a new div here with some text!!! </div>
-----------------------------------------------------------
This page is somehow the same but not really because:
- All divs are visible
- the div 4.3 have been added
- the div 6 is new too

OK?
Now the question is:
For this second page, considering my reference page, how could I
programmaticall y:
-let divs 1 and 3 visible
-hide divs 2, 4, 5 ( and all children divs of 4)
-hide div 6 too.

Thanks for all kind of suggestions.

Num,
1/. Give all divs an id="something" statement so you can
'programmatical ly' FIND them .

2/. Write a program that on some event, finds them and sets their
style.display property between 'inline' and 'none'.

3/. If you want stuff to overlay stuff, look at the Z-index style attribute.

4/. if its just a question of switching a page put it in one div
container and switch that.
Nov 18 '08 #2

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

Similar topics

1
7504
by: Ron Bott | last post by:
I have a fixed size <div> I would like to display in the center of a browser window. To get the horizontal alignment is no problem using 'margin-left: auto' and 'margin-right: auto' but I cannot figure out how to get it to centet vertically. Any ideas? Ron Bott
14
14975
by: Charlie T | last post by:
Hello, is there any way to get this to work? myID.innerHTML = "Hello" <DIV id="myID"></DIV> <DIV id="myID"></DIV>
3
4364
by: tungchau81 | last post by:
Hi, A Modal Dialog does not allow us to highlight the text content inside <DIV> tag unless I use a <textarea> tag to display that text content. However, the situation of my software makes it impossible to use <textarea> and Modeless dialog. I am really stuck!!! Is there any trick to make <DIV> or <SPAN>'s content be selectable in a Modal dialog? Thanks in advance,
5
13161
by: hibernate | last post by:
I'm somewhat new to javascript/DHTML, and this problem has been plaguing me. I have made an 'array' of <div> tags within my html document like so: <div id="menu"> menu1 </div> <div id="menu"> menu2 </div> <div id="menu"> menu3 </div> <div id="menu"> menu4 </div> <span onclick="showOrHide('menu')"> show/hide menu1 </span>
4
3080
by: adriann | last post by:
Hi, I'm using PHP to echo or stream out some DIV tags with content inside, by a user selection, and after a page has initially loaded. My question is, Can I erase this dynamically created DIV container through a "close" button within the DIV... or... some other method? thank you.
0
1162
by: tawxic | last post by:
My code is thus: <div id="navigation"> <ul> <li><a href="#">Home</a></li> <li><a href="#">About Phazm</a></li> <li><a href="#">Services Offered</a></li> <li><a href="#">Request Services</a></li> <li><a href="#">CEO Blog</a></li> <li><a href="#">Contact</a></li> </ul>
7
2606
by: howa | last post by:
hi all, consider the example below: ////////////////////// <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=big5" /> <title>Untitled Document</title> <style type="text/css">
5
3294
uranuskid
by: uranuskid | last post by:
Hey guys, I control my webappearance ewith a series of <div> elements. They are supposed to be in line and the main container is supposed to stay min 880px in wdth. However, the left infobox has somehow the bad habit to start under the main <div> element. Also, the min-width is not kicking in, instead the elements get floated to the left and no scroll bar appears. #container { font-size: 0.8em; width: 900px; min-width: 880px; ...
0
2104
by: Martin Plotz | last post by:
Hi all, is it possible to say "I'd like a <divwith width:100% and an aspect ratio of height/width=2/3" in a way that browsers understand? Thanks for hints, Martin
0
9455
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
9271
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
10031
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
8709
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
7242
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
6534
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5140
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2665
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.