日期:2014-05-16 浏览次数:20464 次
<input type="text" name="txtAddr" maxlength="100"/><a href="javascript:void(0);" onclick="addInput1();">添加</a>
function addInput1()
{
document.getElementById("txtAddr").innerHTML=document.getElementById("txtAddr").innerHTML+"\<input type=\"text\" name=\"txtAddr\" maxlength=\"100\"/>"
}
<div id="txtAddr"><input type="text" name="txtAddr" maxlength="100"/></div>
<a href="javascript:void(0);" onclick="addInput1();">添加</a>
<script type="text/javascript">
function addInput1()
{
var input = document.createElement("input");
input.type="text";
input.name="txtAddr";
input.maxlength="100";
document.getElementById("txtAddr").appendChild(input);
}
</script>