473,399 Members | 4,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

collapse/hidden/visible

ok, so i am working with a script like this:

Expand|Select|Wrap|Line Numbers
  1. function addPrinciples(){
  2.   var s = '<div id="PrinciplesContainer" class="Container"><ul>';
  3.   s += '<form id="principles">'
  4.   for (var i in Principles){
  5.     node = Principles[i];
  6.     s+= '<li id='+node.id+'>';
  7.     s+= '<input type="checkbox" style="Container" onClick="getAjaxPrincipleInfo()" '+(node.checked?'checked':'')+' value="principle"'+node.id+'>' +node.title + '</input></li>';    
  8.   }
  9.   s+='</ul></form></div>'
  10. //  alert(s);
  11.   document.getElementById("filterContainer").innerHTML += s;
  12. }
  13.  
  14.  
  15. function initDisplay(){
  16.   addCategories();
  17.   addPrinciples();
  18.   setDisplay();
  19. }
  20.  
  21. function setDisplay(){
  22.   if (document.getElementById('radioCategories').checked) {
  23.     document.getElementById('SubCategoriesContainer').style.visibility = 'visible';
  24.     document.getElementById('PrinciplesContainer').style.visibility = 'collapse';
  25.   }
  26.   else{
  27.     document.getElementById('SubCategoriesContainer').style.visibility = 'collapse';
  28.     document.getElementById('PrinciplesContainer').style.visibility = 'visible';
  29.   }
  30. }
and my css:

Expand|Select|Wrap|Line Numbers
  1. .Container {
  2.   position: static;
  3.   padding: 5px 5px 5px 5px;
  4.   background-color:#99CC67;
  5.   border: 1px solid darkgreen;
  6.   overflow: auto;
  7.   width: 208px;
  8.  
  9. }
it ends up giving me a black box where something. say click one thing you get a black box where the other one will be, and vice versa. If anyone knows how to help with this that would be greatly appreciated.
Jul 18 '07 #1
4 4107
gits
5,390 Expert Mod 4TB
hi ...

try display:none; (for visibility:collapse;) and display:'block' (for visibility:collapse) instead ... may be that helps?

kind regards
Jul 18 '07 #2
well, it gets rid of the black box, but it isn't replacing the first open box with the new open box. Thanks for the help though.
Jul 18 '07 #3
gits
5,390 Expert Mod 4TB
hmmm ... the following example works:

[HTML]<script>
function setDisplay(){
if (document.getElementById('radioCategories').checke d) {
document.getElementById('SubCategoriesContainer'). style.display = 'block';
document.getElementById('PrinciplesContainer').sty le.display = 'none';
}
else{
document.getElementById('SubCategoriesContainer'). style.display = 'none';
document.getElementById('PrinciplesContainer').sty le.display = 'block';
}
}
</script>
<body onload="setDisplay();">
<input type="checkbox" id="radioCategories" checked="true" onclick="setDisplay();">
<div id="SubCategoriesContainer">test</div>
<div id="PrinciplesContainer">test1</div>
</body>
[/HTML]

do you get any errors? javascript or css-ones? try firefox and its js-console ... that should show a lot of error-information ... in case there are some ;)

kind regards

ps: tested it in FF, IE5(Mac) with and without your CSS ... works. may be there's an error with the other js-functions that creates the content ... in case it is not too much code post the entire page here or pm it to me ... i'll have a closer look at it and try to extract the relevant things?
Jul 18 '07 #4
thanks, greatly appreciated.
Jul 18 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: James Hurrell | last post by:
Hi, I'm using the following javascript function to expand and collapse portions of text in a web page (targeted at IE5.5 and above): function doExpand(paraNum,arrowNum) { if...
3
by: Jukka K. Korpela | last post by:
I have noticed that the meaning of visibility: collapse has been discussed on different forums, but with no consensus on what it really means. Besides, implementations differ. The specification...
3
by: ireneatngs | last post by:
Hi, I have example html below which contains a couple of hidden divs. However, some of the table borders within these hidden divs are actually displayed when they should not be. In my...
4
by: Alvaro G Vicario | last post by:
I have a list built on HTML and CSS: <ul> <li>Foo</li> <li>Bar <ul> <li>Gee</li> </ul> </li> </ul>
3
by: Erwin Moller | last post by:
Hi all, Is it possible to collapse certain columns in a rendered table? I have been fiddling around with CSS and visibiliy: collapse, but I cannot get it working in NN6 and IE6 and firefox. ...
0
by: invinfo | last post by:
I read some NG posts on this and also looked at W3C and others. http://www.w3.org/TR/CSS2/tables.html http://aerie.chirp.com.au/css/bordercollapse/ I could not make border-style: hidden...
2
by: Jenny | last post by:
My codebehind file contains a lot of sub's. Is there a fast way to expand and collapse them in the VisualStudio? It's really exhausting to collapse them all after opening the project in the...
7
by: sirfunusa | last post by:
Does anyone have sample code for an expanding parent/child datagrid. Like a treeview control with the "+/-" signs. ASP.NET 1.1 thanks Jeff
3
by: Max58kl | last post by:
Hi I am currently trying to create a FAQ webpage. At the moment the code I have lets me click on the Questions which successfully shows and hides the <DIV> tags containing the Answers. But...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.