<script>
var count=1;
function write(m)
{
count+=m;
var s='';
for (var i=0;i<count;i++)
{
s+="<input type=text name=xx ><br>";
}
a.innerHTML=s;
}
</script>
<div id=a><input type="text" name="xx"><br></div>
<input type="button" name="Submit" value="增加" onClick="write(1)">
<input type="button" name="Submit" value="减少" onClick="write(-1)">
var count=1;
function write(m)
{
count+=m;
var s='';
for (var i=0;i<count;i++)
{
s+="<input type=text name=xx ><br>";
}
a.innerHTML=s;
}
</script>
<div id=a><input type="text" name="xx"><br></div>
<input type="button" name="Submit" value="增加" onClick="write(1)">
<input type="button" name="Submit" value="减少" onClick="write(-1)">
<input type="button" name="Submit" value="增加" onClick="javascript:a.innerHTML=a.innerHTML+'<input type=text name=xx >'">
<input type="button" name="Del" value="减少"
onClick="Del()">
<script>
function Del()
{
var txt = document.getElementsByName("xx");
if(txt.length)
{
txt[txt.length-1].removeNode(true);
}
}
</script>
二楼的不知道怎么回事怎么点添加就显示1点减少就显示-1。input框没变化。
多爱我一天的很好用,多谢拉