Microsoft KB Archive/235949

= How To Control the Rows Displayed in a Table Using a List Box =

Article ID: 235949

Article Last Modified on 8/8/2007

-

APPLIES TO


 * Microsoft Internet Explorer 4.0 128-Bit Edition
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 4.01 Service Pack 1
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 5.0
 * Microsoft Internet Explorer 5.5

-



This article was previously published under Q235949



SUMMARY
This article demonstrates how to show or hide table rows based on a list box selection. You can display a single row or multiple rows depending on the number of selections in the list box.



MORE INFORMATION
This section contains sample Jscript code that you can use to toggle the display of a single row, or multiple rows, in a table depending on the choices made in a list box. There are two ways demonstrated in the sample code.
 * ShowRowName function: This function displays or hides the selected rows based on the name of the row. Use this function when you don't want to toggle the display of all rows.
 * ShowRowCount function: This function uses the number of the row to control the display value. Use this method when there is a one-to-one and sequential relationship between the entries in the select box and the table rows you wish to toggle the display of.

  How To Control What Rows Display in a Table using a List Box   

 Display and Hide Table Rows Sample  

Row 1 <OPTION VALUE = "tblRow2">Row 2 <OPTION VALUE = "tblRow3">Row 3 </SELECT>

<INPUT ID=btnShowRowName NAME=btnShowRowName TYPE=button VALUE="Show Selected Row by Name" onclick=ShowRowName(lstRows)> <INPUT ID=btnShowRowCount NAME=btnShowRowCount TYPE=button VALUE="Show Selected Row by Count" onclick=ShowRowCount(lstRows)> </P>

</BODY> </HTML>

<div class="references_section">