<script>
function addRow()
{
var oTb = document.getElementById("tb");
var oTr = oTb.insertRow();
var oTd = oTr.insertCell();
oTd.innerHTML="<input class='s01' name='txt' onblur='getTotal();'>";
oTd = oTr.insertCell();
oTd.innerHTML= "<input class='s01' name='user' >"
}
function getTotal()
{
var objLength = document.getElementsByName("user").length;
//alert(objLenth);
if(objLength>0){
for(i=0;i<objLength;i++){
var message= document.getElementsByName("txt")[i].value;
document.getElementsByName("user")[i].value = message;
}
}else{
alert("请点击添加按钮");
}
}
</script>
<style>
.noB{
border:0px;
background:#3399CC;
}
</style>
<link href="../Css/css.css" rel="stylesheet">
<table id="tb">
<tr>
<td>
sss
</td>
</tr>
</table>
<input type="button" name="btn" value="增加" class="s02" onclick="addRow();"/>
posted on 2006-04-18 22:21
水煮三国 阅读(1106)
评论(1) 编辑 收藏 所属分类:
JavaScript