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!

hidden table rows...

Status
Not open for further replies.

thompom

Technical User
Dec 4, 2006
395
GB
hi,

the source html below is from something ive been trying to make for ages.
it displays a list of car makes with the models underneath
in hidden rows.
when someone clicks "<input name=showhide type=image onClick=FuncShowHide();chgimg(this);return false; src=images/showbut2.gif width=13 height=9>"
the models are revealed.

i can do this with static table rows but this table is produced from a database - this is as far as i have got please help

Code:
<script type="text/javascript">
//showhide
function showHide(inrow) {
   rowArr = document.getElementById("theTable").rows;
   for (x=0; x<rowArr.length; x++){
      theRow = rowArr[x];
      theRow.style.display = theRow.style.display == "none" ? "block" : "none"
   }
}
function chgimg(obj) {
    obj.src=(obj.src.indexOf("showbut2.gif")!=-1)? "images/hidebut2.gif":"images/showbut2.gif";
}
</script>
 <script language="javascript" type="text/javascript">
   function FuncShowHide(){
      if (document.getElementsByName("hideShow").style.display == document.getElementsName("trX").style.display){
         document.getElementsByName("hideShow").style.display = "none";
      } else {
         document.getElementsByName("hideShow").style.display = document.getElementsName("trX").style.display
      }
   }
</script>

<table border=0 cellspacing=0 cellpadding=2>

****CAR MAKE

<tr name=trX>
<td colspan=2>
<a href=3coltemp.asp?pagesetupid=2&x_Make=11&z_Make==,','><span class=quickfindlge>Citroen</span></a>
</td>
<td>
<input name=showhide type=image onClick=FuncShowHide();chgimg(this);return false; src=images/showbut2.gif width=13 height=9>
</td>
<td><span class=quickfindlge>(1)</span>
</td>
</tr>

****MODEL
<tr name=hideshow style="display: none;">
<td>
<img src=images/spacer.gif width=5>
</td>
<td>
<a href=3coltemp.asp?pagesetupid=2&x_Model=C3&z_Model==,','&x_Make=11&z_Make==,','><span class=quickfind>C3</span>
</a>
</td>
<td>
</td><td>
<span class=quickfind>(1)</span></td>
</tr>

****CAR MAKE
<tr name=trX>
<td colspan=2>
<a href=3coltemp.asp?pagesetupid=2&x_Make=13&z_Make==,','><span class=quickfindlge>Chevrolet</span></a>
</td>
<td>
<input name=showhide type=image onClick=FuncShowHide();chgimg(this);return false; src=images/showbut2.gif width=13 height=9>
</td>
<td>
<span class=quickfindlge>(37)</span>
</td>
</tr>

****MODEL
<tr name=hideshow style="display: none;">
<td>
<img src=images/spacer.gif width=5>
</td>
<td>
<a href=3coltemp.asp?pagesetupid=2&x_Model=KALOS&z_Model==,','&x_Make=13&z_Make==,','><span class=quickfind>KALOS</span></a>
</td>
<td>
</td>
<td>
<span class=quickfind>(7)</span>
</td>
</tr>

****MODEL
<tr name=hideshow style="display: none;">
<td>
<img src=images/spacer.gif width=5>
</td>
<td>
<a href=3coltemp.asp?pagesetupid=2&x_Model=LACETTI&z_Model==,','&x_Make=13&z_Make==,','><span class=quickfind>LACETTI</span></a>
</td>
<td></td>
<td>
<span class=quickfind>(20)</span>
</td>
</tr>
</table>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top