var row = 0;
function insertElement() {
var nod=document.createElement("span");
document.form1.insertBefore(nod);
nod.innerHTML="<br>row"+row+"<input type=text name=txt["+row+"][]><input type=text name=txt["+row+"][]>"
row = row+1
}
</SCRIPT>
<BODY>
动态增加文本框
<form name=form1 action=<? echo $PHP_SELF; ?> method=POST>
<input type=submit value="提交"><input type=button value=增加 onclick="insertElement()"><br>
</form>
<pre>
<?
print_r($HTTP_POST_VARS);
?>
</pre>
</BODY>
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/