欢迎光临
我们一直在努力

动态增加表单元素

建站超值云服务器,限时71元/月

<html>
<head>
<title>untitled document</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#ffffff" text="#000000">
<table>
  <tr>
    <td><input type="tex" name="text"></td>
<td bgcolor="#ffffff"><input type="text" name="text"></td><td bgcolor="#ffffff"><input type="text" name="text"></td><td bgcolor="#ffffff"><input type="text" name="text"></td><td ><input type="text" name="text"></td>
</tr>
     

      
</table>
<input type="button" name="add_line" value="增加下一行" onclick="addfileinput()">
</body>
</html>
<script language="vbscript">

nowfileinputno = 1
nowfileinputcount = 0
sub addfileinput()
  if nowfileinputcount < 10 then
  htmlsrc = "<table id=fileinput"& nowfileinputno &"><tr><td> <input type=""text"" name=""text""></td><td><input type=""text"" name=""text""></td><td><input type=""text"" name=""text""></td><td><input type=""text"" name=""text""></td>"
  htmlsrc = htmlsrc & "<td><input type=""text"" name=""text""><input type=button value=删除 class=cbutton onclick=""delfileinput("& nowfileinputno &")""></td></tr></table>"& vbcrlf

   document.all.add_line.insertadjacenthtml "beforebegin", htmlsrc
   nowfileinputno = nowfileinputno + 1
   nowfileinputcount = nowfileinputcount + 1
  else
   alert "增加太多记录行"
  end if
end sub

sub delfileinput(tableno)
      document.all("fileinput"& tableno).outerhtml = ""
    nowfileinputcount = nowfileinputcount – 1
end sub
</script>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 动态增加表单元素
分享到: 更多 (0)

相关推荐

  • 暂无文章