MyException - 我的异常网
当前位置:我的异常网» Java Web开发 » 怎么在表格中自动增加行,并对输入的数据作判断

怎么在表格中自动增加行,并对输入的数据作判断(2)

www.MyException.Cn  网友分享于:2013-12-27  浏览:279次

var ins=curRow.getElementsByTagName( "INPUT ");
for(j=0;j <ins.length;j++){
var curIn=ins[j];
document.getElementById( "di ").innerHTML+= "控件名称: "+curIn.name+ " <br> 值: "+curIn.value+ " <br> ";
// alert(curIn.name+ "\n "+curIn.value);
}
}
}
}
function GetValue()
{
var id;
var a;
var b;
for(i=0;i <filetb.rows.length;i++)
{
a = filetb.rows(i).cells(0).innerText;
a = a.substring(2,3);
id = "txtCode " + a;
document.all( "txt ").value += document.all(id).value;
}
}
//删除,,换个方法
function deleteRow(rid){
// alert(document.getElementsByTagName( "tr ").length);
// alert(filetb.getElementsByTagName( "tr ").length);

for(i=0;i <filetb.rows.length;i++){
var curRow=filetb.rows[i];
if( 'tdt '+rid==curRow.id){
document.getElementById( "di ").innerHTML+= "删除行: "+rid+ " <br> ";
filetb.deleteRow(i);
}
}
}
function removeatt(ln)
{
var i
var tdname
var tdln
var line=ln;
if (line> 0) {
for (i=0;i <filetb.rows.length;i++) {
tdname=filetb.rows[i].name;
tdln=tdname.substring(3,tdname.length);
if (tdln==line) {
filetb.deleteRow(i);
break;
}
}
}
}
</script>
</head>
<body>
<form id= "form1 " name= "form1 " method= "post " action= " " runat= "server ">

<input type=button onclick= "return addAttachment() " id=btnNew value= "增加 " />
<input type= "text " id=txt />
<table>
<tr> <td>
<table id= "filetb " border= "1 ">
<TR name= "aa " class= "list_over ">
<Td width= "100px "> a </Td>
<Td width= "160px "> b </Td>
<Td width= "100px "> c </Td>
<Td width= "160px "> d </Td>
</TR>
</table>
</td> </tr>
</table>
</form>
<div id= "di "> </div>
</body>
</html>

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有