自定义输入框个数

    技术2022-05-11  3

    <% @ page contentType="text/html;charset=GBK" %> < SCRIPT  language =javascript > var N;N=1function addYXDS(){var obj = document.getElementsByName("YXDS")[document.getElementsByName("YXDS").length-1];//obj.insertAdjacentHTML("afterend","<br/><input type="text" name="text1">");obj.insertAdjacentHTML("afterend","<br/><input size="40" type="text" name=YXDS>");N=N+1} </ SCRIPT > < form  action =do.jsp > < INPUT  id =YXDS0  size =40  name =YXDS >   < BR > < INPUT  onclick =addYXDS()  type =button  value =添加  name =Submit3 > < INPUT  onclick ="javascript:alert(document.getElementsByName('YXDS').length);"  type =button  value =aaa  name =Submit3 > < input  type =submit > </ form > <!-- do.jsp --> <% @ page contentType="text/html;charset=GBK" %> <% String a[]=request.getParameterValues("YXDS");out.print("v1="+a[0]+"<BR>");out.print("v2="+a[1]+"<BR>");out.print("个数="+a.length); %>  

    最新回复(0)