隨筆 - 154  文章 - 60  trackbacks - 0
          <2007年11月>
          28293031123
          45678910
          11121314151617
          18192021222324
          2526272829301
          2345678

          聲明:

          該blog是為了收集資料,認識朋友,學習、提高技術,所以本blog的內容除非聲明,否則一律為轉載??!

          感謝那些公開自己技術成果的高人們!!!

          支持開源,尊重他人的勞動?。?

          常用鏈接

          留言簿(3)

          隨筆分類(148)

          隨筆檔案(143)

          收藏夾(2)

          其他

          學習(技術)

          觀察思考(非技術)

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          代碼:

          <html>
          <head>
          <meta http-equiv="Content-Language" content="zh-cn">
          <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
          <title>001</title>
          <script language=javascript type=text/javascript>
          function paixu(){
          var obj=document.getElementsByTagName("table")[0],obj2=obj.cloneNode(true).rows,a=new Array();
          while(obj.rows.length!=1)
          obj.rows[
          1].removeNode(true);
          for(var i=1;i<obj2.length;i++)
          a[a.length]
          =obj2[i];
          a.sort(
          function(a,b){
          return b.cells[1].innerText-a.cells[1].innerText;}

          );
          for(var i=0;i<a.length;i++)
          obj.firstChild.appendChild(a[i]);
          }

          </script>
          </head>

          <body>

          <table border="1" width="100%" id="table1" cellspacing="1">
              
          <tr>
                  
          <td width="172">代 碼</td>
                  
          <td>名 稱</td>
              
          </tr>
              
          <tr>
                  
          <td width="172">001</td>
                  
          <td>11111</td>
              
          </tr>
              
          <tr>
                  
          <td width="172">002</td>
                  
          <td>3333</td>
              
          </tr>
              
          <tr>
                  
          <td width="172">00101</td>
                  
          <td>22222</td>
              
          </tr>
              
          <tr>
                  
          <td width="172">00201</td>
                  
          <td>4444</td>
              
          </tr>
          </table>
              
          <p><button name="B3" onclick='paixu();'>排 序</button></p>

          </body>
          </html>
          posted on 2007-11-29 17:00 lk 閱讀(917) 評論(1)  編輯  收藏 所屬分類: ajax&js

          FeedBack:
          # re: js table操作--------- 內容排序[未登錄] 2011-04-26 17:14 aaa
          www.hnzhipu.cn vvvvvvvvvvv  回復  更多評論
            
          主站蜘蛛池模板: 汉阴县| 徐汇区| 甘孜| 鄯善县| 南昌县| 林州市| 道孚县| 平乐县| 海安县| 涞水县| 乌兰县| 昭觉县| 宜春市| 宿松县| 巴里| 育儿| 双柏县| 灌南县| 东城区| 安吉县| 永胜县| 孝义市| 高唐县| 青川县| 曲周县| 黄浦区| 南充市| 金沙县| 聂荣县| 贵德县| 南和县| 吉水县| 阜南县| 长乐市| 镇宁| 长宁县| 邵武市| 南投县| 德令哈市| 湄潭县| 福安市|