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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show hidden table by clicking a cell in another table

Status
Not open for further replies.

wdev

Programmer
Nov 29, 2001
2
CA
Hi,

I have an asp page to show and hide table, the code is as follow:

<html>
<head>..............</head>
<script language=&quot;javascript&quot; >
function ShowAll( ){
var remove_el=document.all.remove
remove_el.style.display=''
}

function HideAll( ) {
var remove_el=document.all.remove
remove_el.style.display='none'
}

function Show(argDiv ){
if (argDiv=='A'){ var remove_el=document.all.TableA; }
if (argDiv=='B'){ var remove_el=document.all.TableB; }
if (argDiv=='C'){ var remove_el=document.all.TableC; }
for (i=0;i<remove_el.length ; i++)
remove_el.style.display=''
}

function Hide(argDiv){
if (argDiv=='A'){ var remove_el=document.all.TableA; }
if (argDiv=='B'){ var remove_el=document.all.TableB; }
if (argDiv=='C'){ var remove_el=document.all.TableC; }
for (i=0;i<remove_el.length ; i++)
remove_el.style.display='none'
}
</script>

<body onload=&quot;HideAll( )&quot;>
<%
....
'create Table1
</table>
...
<td><a href=&quot;javascript:Show('A');&quot;>display A</a></td></tr>
...
<td><a href=&quot;javascript:Show('B');&quot;>display B</a></td></tr>
...
<td><a href=&quot;javascript:Show('C');&quot;>display C</a></td></tr>
</table>
....
<a href=&quot;javascript:ShowAll( );&quot;>show all</a>
.............
'create TableA
<div id=&quot;remove&quot;>
<table id=&quot;TableA&quot;>
.........
<th><a href=&quot;javascript:Hide('A');&quot;>QtyA</a></tr>
.........
</table>

........
'create TableB
<table id=&quot;TableB&quot;>
.........
<th><a href=&quot;javascript:Hide('B');&quot;>QtyB</a></tr>
.........
</table>


.......
'create TableC
<table id=&quot;TableC&quot;>
.........
<th><a href=&quot;javascript:Hide('C');&quot;>QtyC</a></tr>
.........
</table>
</div>

%>


When I first load it,
1.Table1 display successfully;
2. TableA, B, C all hidden;

Click on display A,
1. does not display TableA

Click on display B,
1. does not display TableB

Click on display C
1. does not display TableC

Click on show all,
1. display all 3 TableA, B, C

Click on QtyA,
1. hide TableA

Click on QtyB,
1. hide TableB

Click on QtyC
1. hide TableC

Further Click on show all,
1. does not display the 3 TableA, B, C

Further Click on display A,
1. show TableA

Further Click on display B,
1. show TableB

Further Click on display C
1. show TableC

Please help to find out:
why the first time click on display A or display B or display C do not show the corresponding table;
why the show all only show the 3 tables once - after the first time display it won't show the 3 tables again;

Thanks in advance,
William
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top