Archived

This topic is now archived and is closed to further replies.

johnnyBravo

Javascript and HTML; making table, that can be sorted

Recommended Posts

I need to make a table using html, and with the headings , if i click on them the data in that column will be sorted alphabetically using javascript. Ive made a html table, but i don't see how to make it rearange values for the sort.
<TABLE BORDER="1" CELLSPACING="1" CELLPADDING="1">

<TR> <TD ALIGN = "center"> Product ID</TD>
<TD ALIGN = "center"> Product Name </TD>
<TD ALIGN = "center"> Product Description </TD>
<TD ALIGN = "center"> Quantity </TD>

</TR>
<TR>
<TD ALIGN = "center"> 41256 </TD>
<TD ALIGN = "center"> Compaq Presario </TD>
<TD ALIGN = "center"> Pentium 4, 2.4 GHz, 512 MB Ram </TD>
<TD ALIGN = "center"> 5 </TD>
</TR>

<TR>
<TD ALIGN = "center"> 61728 </TD>
<TD ALIGN = "center"> Diamond Monitor </TD>
<TD ALIGN = "center"> 17' LCD </TD>
<TD ALIGN = "center"> 12 </TD>
</TR>
<TR>
<TD ALIGN = "center"> 18692 </TD>
<TD ALIGN = "center"> Imation Super Disk</TD>
<TD ALIGN = "center"> 120 Mb floppy external drive </TD>
<TD ALIGN = "center"> 7 </TD>
</TR>
<TR>
<TD ALIGN = "center"> 51961 </TD>
<TD ALIGN = "center"> IBM Laptop </TD>
<TD ALIGN = "center"> Pentium 4, 2.0 Ghz, 256 MB Ram, active screen </TD>
<TD ALIGN = "center"> 4 </TD>
</TR>
</TABLE>
[edited by - johnnyBravo on November 17, 2003 8:38:33 AM]

Share this post


Link to post
Share on other sites