隨筆-200  評論-148  文章-15  trackbacks-0
          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
          <html xmlns="http://www.w3.org/1999/xhtml">
          <head>
          <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
          <title>無標題文檔</title>
          ?<script type="text/javascript" src="js/selectrole.js"></script>
          ? <script type="text/javascript" src="js/signin.js"></script>
          </head>

          <body>
          <form id="form1" name="form1" method="post" action="">
          ? <table width="292" height="62" border="1">
          ??? <tr>
          ????? <td width="53">編號</td>
          ????? <td width="223"><label>
          ??????? <input type="text" name="textfield" />
          ????? </label></td>
          ??? </tr>
          ??? <tr>
          ????? <td>姓名</td>
          ????? <td><label>
          ??????? <input type="text" name="textfield2" />
          ????? </label></td>
          ??? </tr>
          ??? <tr>
          ????? <td>登錄名</td>
          ????? <td><label>
          ??????? <input type="text" name="textfield3" />
          ????? </label></td>
          ??? </tr>
          ?? ???? <tr>
          ????? <td>身份</td>
          ????? <td><label>
          ??????? <input type="text" name="role" />
          ??????? <input type="button" name="Submit2" value="..." onclick="openwindow();" />
          ????? </label></td>
          ??? </tr>
          ? </table>
          ? <input type="button" name="Submit" value="保存" onclick="savesignin();" />
          </form>
          <table id="signin" width="445" border="1">
          ? <tr>
          ??? <th width="68" scope="col">編號</th>
          ??? <th width="42" scope="col">姓名</th>
          ??? <th width="67" scope="col">登錄名</th>
          ??? <th width="49" scope="col">身份</th>
          ??? <th width="85" scope="col">創建時間</th>
          ??? <th width="94" scope="col">登錄時間</th>
          ? </tr>
          </table>
          <p>&nbsp;</p>
          </body>
          </html>
          // JavaScript Document
          function savesignin(){

          //添加一行

          var newTr = document.getElementById("signin").insertRow(-1);

          //添加兩列

          var newTd0 = newTr.insertCell(-1);

          var newTd1 = newTr.insertCell(-1);

          var newTd2 = newTr.insertCell(-1);

          var newTd3 = newTr.insertCell(-1);

          var newTd4 = newTr.insertCell(-1);

          var newTd5 = newTr.insertCell(-1);


          //設置列內容和屬性

          newTd0.innerHTML = '測試';

          newTd1.innerHTML= '新加行';
          newTd2.innerHTML = '測試';

          newTd3.innerHTML= '新加行';
          newTd4.innerHTML = '測試';

          newTd5.innerHTML= '新加行';

          }
          posted on 2008-01-12 09:55 無聲 閱讀(3559) 評論(2)  編輯  收藏 所屬分類: 職場生活

          評論:
          # re: js動態修改表格 2008-07-17 14:53 | as
          as  回復  更多評論
            
          # re: js動態修改表格 2016-04-24 00:59 | 35454
          454545  回復  更多評論
            
          主站蜘蛛池模板: 镶黄旗| 德安县| 大同市| 秦安县| 漠河县| 田阳县| 延川县| 西青区| 宁强县| 普宁市| 纳雍县| 顺昌县| 墨江| 清水河县| 洛南县| 渑池县| 芦溪县| 宜宾县| 铜梁县| 吴堡县| 保亭| 石城县| 永城市| 息烽县| 长阳| 宿州市| 内丘县| 大埔区| 阳原县| 吉木萨尔县| 留坝县| 慈利县| 荣成市| 乌恰县| 盐城市| 南木林县| 金川县| 清远市| 五原县| 禹城市| 绥棱县|