编码:
var i=0,j=0;
var t1= new Array();
function createtext(){
i++;
t1[i]=document.createElement('input');
t1[i].type='text';
t1[i].name='text'+i;
t1[i].value = "hello"+i;
t1[i].size = 10;
document.forms[0].appendChild(t1[i]);
var mybr=document.createElement("<br>");
document.appendChild(mybr);
}
表格:
<form action="" method="get" name="f1">
<input name="b1" type="button" onClick="createtext()" value="+">
</form>
单击“+”按钮时,文本框将向下生成而不是每个文本框的侧面。然后每个文本框在其侧面都有一个“删除”链接。当单击“删除”时,文本框将删除。请帮助我。
------------------------------------------------
(+) <-imagine this is the button
[SAMPLETEXTBOX1] REMOVE <-imagine a textbox1 with remove link beside it
[SAMPLETEXTBOX2] REMOVE <-imagine a textbox2 with remove link beside it
[SAMPLETEXTBOX1] REMOVE <-imagine a textbox3 with remove link beside it