kxbin
          成功留給有準備的人
          posts - 10,  comments - 35,  trackbacks - 0
          <html>
          <head>
          <script>
          function test(){
          var ls_t =   window.document.all("table1"); //獲得id為talbe1的對象
          var trIndex = window.document.all("tr1");
          maxcell=ls_t.rows(0).cells.length;
          mynewrow = ls_t.insertRow();  //添加新行
          if(!trIndex.value) {
          trIndex.value = 0;
          }
                      trIndex.value = parseInt(trIndex.value) + 1;
          mynewrow.setAttribute("id","tr" + trIndex.value); //添加一個變量為id
          mynewcell=mynewrow.insertCell();   //添加新列
          mynewcell.setAttribute("align","center");
          mynewcell.innerHTML="1";
          mynewcell=mynewrow.insertCell(); 
          mynewcell.setAttribute("align","center");
          mynewcell.innerHTML="test";
          mynewcell=mynewrow.insertCell(); 
          mynewcell.setAttribute("align","center");
          mynewcell.innerHTML="25";
          }
          </script>
          </head>
          <body>
          <a href="javascript:test()">添加新行新列</a>
          <table id="table1" border="1">
          <tr id="tr1">
          <td>序號</td>
          <td>姓名</td>
          <td>年齡</td>
          </tr>
          </table>
          </body>
          </html>
          posted on 2012-02-28 09:41 kxbin 閱讀(469) 評論(0)  編輯  收藏 所屬分類: javascript
          你恨一個人是因為你愛他;你喜歡一個人,是因為他身上有你沒有的;你討厭一個人是因為他身上有你有的東西;你經常在別人面前批評某人,其實潛意識中是想接近他。

          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          常用鏈接

          留言簿(5)

          隨筆檔案

          文章分類

          文章檔案

          相冊

          收藏夾

          J2EE

          java技術網站

          Linux

          平時常去的網站

          數據庫

          電影網站

          網站設計

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 山阴县| 尼木县| 罗江县| 咸宁市| 桐梓县| 扬中市| 延安市| 义乌市| 连平县| 林州市| 揭西县| 松滋市| 江门市| 焉耆| 故城县| 连州市| 漯河市| 广河县| 临漳县| 麦盖提县| 临沭县| 桃源县| 广水市| 嵊泗县| 阿荣旗| 玛沁县| 内乡县| 榆社县| 陆河县| 稷山县| 齐河县| 阜新| 南靖县| 年辖:市辖区| 新津县| 易门县| 陵川县| 枣庄市| 福清市| 东安县| 公安县|