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

          平時常去的網站

          數據庫

          電影網站

          網站設計

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 彭水| 沽源县| 宿松县| 黔西| 叶城县| 收藏| 汝南县| 武汉市| 伊通| 长岛县| 商城县| 秀山| 宁晋县| 枣阳市| 甘孜县| 靖远县| 江都市| 呼伦贝尔市| 厦门市| 灌云县| 巨鹿县| 通州区| 同心县| 甘泉县| 义马市| 景德镇市| 肇州县| 通州区| 石河子市| 乡城县| 汝南县| 裕民县| 鱼台县| 琼结县| 龙南县| 德保县| 孟连| 泰州市| 枞阳县| 尉氏县| 名山县|