SunQuest
           Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old March 18th, 2004, 11:09 PM
pickleman78 pickleman78 is offline
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Dallas,TX,USA
Posts: 582 pickleman78 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to pickleman78
Collapsing table

Alright, here;s what I need, I have this table, and I want to collapse it. What I have at this point is this JavaScrip:
Code:

<Script Language=JavaScript>
var oldStuff=new Array();
oldStuff[0]=document.getElementById('2');
oldStuff[1]=document.getElementById('2').outerText;


function collapse()
{
oldStuff[0]=document.getElementById('2');
oldStuff[1]=document.getElementById('2').innerHTML;

var theRow=document.getElementById('2');
var theLink=document.getElementById('excol1');
theRow.outerText="";
theLink.outerHTML="<a href="javascript:expand()">-</a>";
}

function expand()
{
	var theRow=oldStuff[0];
	theRow.innerHTML=oldStuff[1];
}

</script>


Collapse works as expected, the table row disappears, and moves the previous row up into its place.
expand does not work. When i do
alert(theRow.innerHTML); I get what should be there, both before and after, but it never shows back up on my page. Any way I can make this work? Am I going about it at the wrong approach??

Edit: Ok, so I get part of my problem, you can't write a full string to innerHTML on table like objects, so the solution I read said wrap it in a div, well, when I do
alert(document.getElementById('part1').innerHTML); I get a blank. In the HTML I have
<div id="part1">
......(table code here)......
</div>
It should show the table code should it not?

Reply With Quote
  #2  
Old March 19th, 2004, 01:26 AM
zombie zombie is offline
Codewalkers Intermediate (1500 - 1999 posts)
 
Join Date: Apr 2007
Location: serbia
Posts: 1,876 zombie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: Collapsing table

you can show/hide any html element by altering its style.display property. to hide:

element.style.display = "none";

and to show later:

element.style.display = "block";

Reply With Quote
  #3  
Old March 20th, 2004, 04:27 PM
pickleman78 pickleman78 is offline
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Dallas,TX,USA
Posts: 582 pickleman78 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to pickleman78
RE: Collapsing table

Now, the above works great to hide it, but it still won't show back up again

Reply With Quote
  #4  
Old March 20th, 2004, 11:21 PM
zombie zombie is offline
Codewalkers Intermediate (1500 - 1999 posts)
 
Join Date: Apr 2007
Location: serbia
Posts: 1,876 zombie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: Collapsing table

ah, sorry, table row has something other than "block". it is not a "normal" element. ;)

try adding alert(tr.style.display) before you hide it to check that value (it will be somehting like "table-row" or similar) and than replace "block" with that new value..

Reply With Quote
  #5  
Old March 21st, 2004, 04:18 PM
pickleman78 pickleman78 is offline
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Dallas,TX,USA
Posts: 582 pickleman78 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to pickleman78
RE: Collapsing table

whoops, sorry, you were right, I misspelled block :p

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > Collapsing table


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway