js 动态添加表单input元素
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>js 动态添加表单input元素</title>
<script language="JavaScript">
function add(){
tid.insertRow().insertCell().innerHTML = '<input name="test'+tid.rows.length+'">';
}
function test(){
for(i=0;i<tid.rows.length;i++) alert(tid.rows[i].cells[0].innerHTML);
}
</SCRIPT>
</head>
<body>
<button onClick="add()">add</button>
<button onClick="test()">test</button>
<table id="tid" border="0">
</table>
</body>
</html>