•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 391,615 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,620 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 4550 | Replies: 4
![]() |
•
•
Join Date: Jun 2005
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
Javascript/CSS Problem: Display is not properly hiding items (style.display="none")
#1
Jul 30th, 2006
Hello,
The title pretty much describes the problem I'm having. Right now, I've got a <table> with two <tbody>s in it; the first one is visible (display:inline) and the second one is invisible (display:none). The first one contains a button, the second one several form fields. Pressing the button hides the first tbody (style.display="none") and shows the second (style.display="inline"). Filling out the form and pressing a "Save" button at the end hides the second tbody again and shows the first tbody. The trouble is, there is still some blank space left there, which accumulates each time the buttons are pressed, leaving quite a large gap. Note: this is happening in Firefox (using 1.5), it seems to be fine in IE 6. Any help would be appreciated
Example script here: http://www.krofh.net/example.html (taken out of context of the original page it was in, but it still demonstrates the problem) Thanks,
- Jesse
The title pretty much describes the problem I'm having. Right now, I've got a <table> with two <tbody>s in it; the first one is visible (display:inline) and the second one is invisible (display:none). The first one contains a button, the second one several form fields. Pressing the button hides the first tbody (style.display="none") and shows the second (style.display="inline"). Filling out the form and pressing a "Save" button at the end hides the second tbody again and shows the first tbody. The trouble is, there is still some blank space left there, which accumulates each time the buttons are pressed, leaving quite a large gap. Note: this is happening in Firefox (using 1.5), it seems to be fine in IE 6. Any help would be appreciated
Example script here: http://www.krofh.net/example.html (taken out of context of the original page it was in, but it still demonstrates the problem) Thanks,- Jesse
•
•
Join Date: May 2005
Location: Wellington, New Zealand
Posts: 182
Reputation:
Rep Power: 4
Solved Threads: 3
Re: Javascript/CSS Problem: Display is not properly hiding items (style.display="none")
#2
Jul 30th, 2006
I think you have forgotten to close the second tbody - this could cause your issue.
•
•
Join Date: May 2005
Location: Wellington, New Zealand
Posts: 182
Reputation:
Rep Power: 4
Solved Threads: 3
Re: Javascript/CSS Problem: Display is not properly hiding items (style.display="none")
#3
Jul 30th, 2006
Sorry, the second tbody is the rest of the table.. my bad.
This all seems over complicated, why don't you use one table... or better, no tables? Then just show and hide div elements?
This all seems over complicated, why don't you use one table... or better, no tables? Then just show and hide div elements?
•
•
Join Date: Jun 2005
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
Re: Javascript/CSS Problem: Display is not properly hiding items (style.display="none")
#4
Jul 30th, 2006
Why not DIV elements? It's because I like lining my forms up in the table with left-align for the name and right-align for the fields. If you could tell me a way to do that with DIVs, that'd be great.
Also, I just made a few changes, because there were a few tags that had gotten lost when I pulled that bit of code out to work just on that... but it still hasn't fixed it.
I ran it through the w3 validator, and there aren't any tags missing or anything wrong with it, so... not sure what's causing the trouble.
Also, I just made a few changes, because there were a few tags that had gotten lost when I pulled that bit of code out to work just on that... but it still hasn't fixed it.
I ran it through the w3 validator, and there aren't any tags missing or anything wrong with it, so... not sure what's causing the trouble. •
•
Join Date: Jun 2005
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
Re: Javascript/CSS Problem: Display is not properly hiding items (style.display="none")
#5
Jul 30th, 2006
Arrr! I have solved the problem, using your suggestion of DIVs. I'm still using lots of tables; part of the excessive table pieces is me trying to work with the typical vBulletin system layout, I'm writing a vB hack... but also, when it parses the templates, it has a tendency to add things like extra <tbody>s in there that I don't really need. Anywho, it's working now, thanks for the suggestion.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
- Create a cross-browser compatible, single-level, drop-down menu (Web Design Tutorials)
- how can i pass a value from java script to JSP scriplet (JSP)
- object.style.display (HTML and CSS)
- New Language combines: Asynchronous JavaScript+CSS+DOM+XMLHttpRequest (JavaScript / DHTML / AJAX)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: combine janascript and php
- Next Thread: Please rectify my error


Linear Mode