主要实现的代码如下: < HTML > < HEAD > < title > xmlhttp2 </ title > < meta name ="GENERATOR" Content ="Microsoft Visual Studio .NET 7.1" > < meta name ="CODE_LANGUAGE" Content ="C#" > < meta name ="vs_defaultClientScript" content ="JavaScript" > < meta name ="vs_targetSchema" content ="http://schemas.microsoft.com/intellisense/ie5" > < SCRIPT src ="sorttable.js" type ="text/javascript" ></ SCRIPT > </ HEAD > < body MS_POSITIONING ="GridLayout" > < form id ="Form1" method ="post" runat ="server" > < table class ="sortable" id ="mytable" > < tr > < td > 用JS实现表格内容的排序排序 </ td > </ tr > < tr > < td bgcolor =#ffcc33 > 其中Table的ID和class都是必须的.且要引入sortable </ td > </ tr > < tr bgcolor =#ff0033 > < td > 222222222222222222222 </ td > </ tr > < tr bgcolor =#00ff00 > < td > 3333333333333333 </ td > </ tr > < tr bgcolor =#ff0066 > < td > 444444444444444444444 </ td > </ tr > </ table > </ form > </ body > </ HTML >