随笔-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 无声 阅读(3537) 评论(2)  编辑  收藏 所属分类: 职场生活

评论:
# re: js动态修改表格 2008-07-17 14:53 | as
as  回复  更多评论
  
# re: js动态修改表格 2016-04-24 00:59 | 35454
454545  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航: