从制造到创造
软件工程师成长之路
posts - 231,  comments - 53,  trackbacks - 0
<html>
    
<head>
        
<script language="javascript">
            
var rowIndex = 0;
            
            
function addOneLineOnClick() {
                
var row = tb.insertRow(tb.rows.length);
                col 
= row.insertCell(0);
                col.innerHTML 
= "<tr><input size='90'  name=btn index=\""+ rowIndex +"\" >";
                col 
= row.insertCell(1);
                col.innerHTML 
= "<input type='button' value='Del'  onclick=\"return DeleteRow('row" + rowIndex +"')\"></tr>";
                row.setAttribute(
"id""row" + rowIndex);
                row.setAttribute(
"name""row" + rowIndex);
                rowIndex
++;
            }

            
function DeleteRow(rowTag){
                
var i = tb.rows(rowTag).rowIndex;
                
var j;
                
for(j=i;j<=rowIndex;j++) { 
                    tb.rows(j).cells(
0).all("btn").index--
                }
                tb.deleteRow(i);
                rowIndex
--;
            }
        
</script>
    
</head>
    
<body >
        
<div align="center">            
            
<table width="95%" name="tb" id="tb">
                
<tr>
                
</tr>
            
</table>
            
<p>            
            
<input name="btnAddLine" type="button" id="btnAddLine" onClick="return addOneLineOnClick()" value="Add">
        
</div>
    
</body>
</html>
posted on 2007-10-09 10:14 CoderDream 阅读(100) 评论(0)  编辑  收藏 所属分类: JavaScript

标题  
姓名  
主页
验证码 *  
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
 
成果网帮您增加网站收入
 
相关链接:
网站导航:


<2007年10月>
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

常用链接

留言簿(5)

我参与的团队

随笔分类(228)

随笔档案(226)

文章分类(3)

文章档案(3)

收藏夹(440)

友情链接

搜索

  •  

积分与排名

  • 积分 - 48242
  • 排名 - 179

最新评论

阅读排行榜

评论排行榜