隨筆-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 無聲 閱讀(3567) 評論(2)  編輯  收藏 所屬分類: 職場生活

          評論:
          # re: js動態修改表格 2008-07-17 14:53 | as
          as  回復  更多評論
            
          # re: js動態修改表格 2016-04-24 00:59 | 35454
          454545  回復  更多評論
            
          主站蜘蛛池模板: 亳州市| 和龙市| 贞丰县| 鹤庆县| 新乡县| 磴口县| 巨野县| 龙里县| 南靖县| 南召县| 越西县| 仁怀市| 射洪县| 富顺县| 昌宁县| 德钦县| 资兴市| 江阴市| 沭阳县| 育儿| 朝阳区| 青川县| 安徽省| 安吉县| 都江堰市| 长乐市| 瓦房店市| 昆明市| 平潭县| 祁阳县| 家居| 宿迁市| 扶沟县| 佛坪县| 保亭| 秦皇岛市| 波密县| 寿宁县| 龙里县| 迭部县| 乌鲁木齐县|