SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: Collapse Div?
-
Mar 17, 2007, 13:45 #1
- Join Date
- Jun 2005
- Posts
- 436
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Collapse Div?
I need a code to make a div collapse and have other divs slide up rather than just disappear. My current code is:
Code:function hideDiv(divId) { divId.style.visibility = 'hidden'; }
-
Mar 17, 2007, 13:57 #2
- Join Date
- Mar 2005
- Location
- USA
- Posts
- 5,482
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You want the display property. What is divId? Is it a string or is it an object?
We miss you, Dan Schulz.
Learn CSS. | X/HTML Validator | CSS validator
Dynamic Site Solutions
Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.
-
Mar 17, 2007, 14:12 #3
- Join Date
- Jun 2005
- Posts
- 436
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Its the ID on my div.
HTML Code:<div id="row_52" class="row"> <span class="update"> <img src="del.gif" onclick="hideDiv('row_52');"> <BR> <div id="saving_52" style="display:none;"> <img src="indicator.gif" width="16" height="16" border="0" align="absmiddle" /> </div> </span> <span class="sideone"> <textarea> asdfasdfasdf </textarea> </span><span class="sidetwo"> <textarea> Text </textarea> </span> </div> <div class="spacer"> </div> </div>
Thanks,
e39m5
-
Mar 17, 2007, 19:33 #4
- Join Date
- Mar 2005
- Location
- USA
- Posts
- 5,482
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
It's a string. We use document.getElementById() to convert that string, that happens to be the ID of an element, into an element reference. Then we set its display property to "none" to hide it completely.
Here's the function.
Code:function hideDiv(divId) { document.getElementById(divId).style.display = 'none'; }
We miss you, Dan Schulz.
Learn CSS. | X/HTML Validator | CSS validator
Dynamic Site Solutions
Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.
Bookmarks