 |
| Javascript How-To Ask your "How do I do this with Javascript?" questions here. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

September 20th, 2004, 03:23 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Display Block : none.... I think
I can include a sample ppt to better explain what I want to do:
Basically I have two <div>s on a page whose content are db-driven. I have a distinct button for each of these that replaces the content of that div by more some other content, (also db-driven). However, the content that replaces the default content for that div "might be" longer than that of the initial block. So what I'm looking for is to push downwards the second div accordingly.
Hope this makes sense .. will probably make more sense once viewed in the ppt.
Thanks for all your help,
nancy
|
|

September 21st, 2004, 02:15 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
I'm missing something here, how are you changing the content and what styles, if any, are the DIVs initially given? Normally when you replace the innerHTML the DIV would just expand and automatically push down the next element.
--
Joe
|
|

September 21st, 2004, 12:26 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
Yes, the DIVs are initiated (one hidden, one visible). The content is db-driven.
Thanks for all your help,
nancy
|
|

September 21st, 2004, 03:44 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
I'm not sure if you caught exactly what Joe was saying....
How are you changing the content?
And, as Joe said...
Quote:
|
quote:Normally when you replace the innerHTML the DIV would just expand and automatically push down the next element.
|
So, what exactly do you want to happen that's not happening?
HTH,
-Snib <><
http://www.snibworks.com
There are only two stupid questions: the one you don't ask, and the one you ask more than once ;)
|
|

September 21st, 2004, 03:57 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
quote:Originally posted by Snib
I'm not sure if you caught exactly what Joe was saying....
How are you changing the content?
And, as Joe said...
Quote:
|
quote:Normally when you replace the innerHTML the DIV would just expand and automatically push down the next element.
|
So, what exactly do you want to happen that's not happening?
HTH,
-Snib <><
http://www.snibworks.com
There are only two stupid questions: the one you don't ask, and the one you ask more than once ;)
|
I probably didn't explain my self clearly: is there anyway I could send you a simple ppt (2 slides) to demonstrate what I'm trying to say?
Let me try again, my page has two distinct <DIVs>: the top one has a button that replaces that DIVs content by *a lot* more content. Which when loaded puts that DIV "on top of" (overlapping) the one below it. What I would like, is that, that bottom DIV not be hidden by the content of the first reloaded DIV, but rather push downwards instead of overlapping.
Hope this is clearer,
Sorry for the confusion and thanks JOE, and SNIB for all your help.
nancy
|
|

September 21st, 2004, 07:15 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
It should, as Joe said, normally push the second div down according to the size of the first.
However, if they are absolutely positioned (i.e. style='position:absolute') you will have to add a line of JS to the call of the button like this:
function whenTheButtonIsClicked()
{
//replace your content however you do
document.getElementById('the_second_divs_id').styl e.top=document.getElementById('the_first_divs_id') .style.bottom;
}
Still, not sure if this is what you want. If it isn't, I think you'll have to link to or e-mail me an example.
HTH!
-Snib <><
http://www.snibworks.com
There are only two stupid questions: the one you don't ask, and the one you ask more than once ;)
|
|

September 30th, 2004, 10:30 AM
|
|
Registered User
|
|
Join Date: Sep 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
this should work
<div id="div01" name="div01">Some content</div>
<div id="div02" name="div02" style="clear:both;">Some content</div>
The second div should clear the first and appear bellow. Do you have any kind of poistionning for those two div's by CSS ? Cause that may interfere.
---------
Goulh
|
|

September 30th, 2004, 10:46 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thank you I'll try both of your suggestions.
|
|
 |