日期:2013-12-10  浏览次数:20528 次

<SCRIPT language="javascript">
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>