Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hiding and showing tables and/or rows

Status
Not open for further replies.

oharab

Programmer
May 21, 2002
2,152
GB
I have to admit: I am pretty new to javascript & css & that sort of thing. I am a vba programmer so can follow through a script, but building my own is something else!

I am trying to create a page with a table on it, but when you click the title, it expands to show a load of hidden rows.

something like:

Total1 5 2 3 4
Total2 1 4 5 1

then when total1 is clicked:
Total1 5 2 3 4
4 2 1 1
0 0 1 1
1 0 1 2
Total2 1 4 5 1

and so on. When you click total1 it hides total's figures. When you click total2 it shows it's subtotals...and so on.

I have found some script that uses check boxes to do a similar sort of thing, but I don't know enough to adapt it to do what I want.
The data will be static and there is no server, so ASP and suchlike is out of the question.
Can anyone help?

Ben ----------------------------------
Ben O'Hara
bo104@westyorkshire.police.uk
----------------------------------
 
Don't know whether this is on the right track for you...

<table border=&quot;1&quot; width=&quot;438&quot; height=&quot;212&quot;>
<tr>
<td>1</td>
</tr>
<tr id=&quot;row2&quot; style=&quot;display:none&quot;>
<td>2</td>
</tr>
<tr>
<td>3</td>
</tr>
</table>

<input type=&quot;button&quot; onclick=&quot;row2.style.display=block&quot;>
 
Hi Ben,

See thread216-287015

Hope this helps,
Erik <!-- My sport: Boomerang throwing !!
This year I will participate at the World Championships in Germany. (!! Many Happy Returns !! -->
 
Thanks for the responses. You are both on the right tracks, but not quite what I want.
I want to do what your code does boomerang, but inside a table.
I want to hide and show complete rows, so that you can expand from a single summary to the rows that make up the summary, just by clicking on the first cell in the table.

Hope you can help.

B ----------------------------------
Ben O'Hara
bo104@westyorkshire.police.uk
----------------------------------
 
I'd looked at that thanks & I have to admit the sheer amount of jscript made my head hurt!
I've managed to do it in only a few lines of vbscript and the tbody tag.
I'd post it here, but it's at work, I will do it on Monday.

Thanks for your help anyway.

Ben ----------------------------------
Ben O'Hara
bo104@westyorkshire.police.uk
----------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top