当前位置: 首页 > 图文教程 > 网络编程 > ASP > 如何使用ASP制作模似动态生长的表单?

ASP
asp中如何限制重复提交同一表单
asp不用DSN访问数据库
ASP文件上传原理分析及实现实例
在ASP程序中访问Access数据库
datagrid编辑、修改、删除、翻页例子
用好ASP.NET 2.0的URL映射
ASP.NET中Datagrid常见错误
ASP.NET 2.0数据缓存功能简介
ASP.NET2.0的缓存控件和地址映射
ASP.NET 2.0中的DataSource系列控件
ASP.NET 2.0中的登陆控件简介
asp存储过程使用
在Asp中使用存储过程
ASP判断文件地址是否有效
ASP+SMTP完成邮件群发功能
用Asp隐藏文件路径实现防盗链
一个通用的保护ASP系统的方法
编写安全的ASP代码
ASP的错误处理集锦
ASP ActiveX 组件

如何使用ASP制作模似动态生长的表单?


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 43 ::
收藏到网摘: n/a

       FILE: DYNAFORM.ASP
  <%@ language = vbscript%>
  <% Response.Expires = 0 %>
  <HTML>
  <HEAD>
  <TITLE>Dynamically Growing Form</TITLE>
  </HEAD>
  <BODY>
  <%
  If Request("Action") = "Submit the List" Then
  ' Show what was entered.
  Response.Write "<B>Here are the Items submitted:</B><BR>"
  nItems = Request.Form("Items").Count
  For I = 1 To nItems
  ' Show submitted Items
  Response.Write Request.Form("Items")(I) & "<BR>"
  Next
  Response.Write Request("Item") & "<BR>"
  
  Else
  
  ' Create the form from all items. %>
  <FORM Action=dynaform.asp Method=Post>
  <B>Items:</B><BR>
  <%
  nItems = Request.Form("Items").Count
  For I = 1 To nItems
  ' Show previously submitted Items
  Response.Write "<INPUT Type=Text Name=Items Value=""" & _
  Trim(Request.Form("Items")(I)) & """><BR>"
  Next
  
  If Request.Form("Item") <> "" Then
  ' paint a new input box, and store the old Item in Items collection
  Response.Write "<INPUT Type=Text Name=Items Value=""" & _
  Trim(Request.Form("Item")) & """><BR>"
  
  Response.Write "<P>Please enter an Item,<BR>"
  Response.Write "and submit them one at a time<BR>"
  Response.Write "by pressing the Add Item button.<BR>"
  Response.Write "<INPUT Type=Text Size=50 Name=Item Value="""""">"
  Else
  ' No Item was submitted, don't show an error
  Response.Write "<P>Please enter an Item,<BR>"
  Response.Write "and submit them one at a time<BR>"
  Response.Write "by pressing the Add Item button.<BR>"
  Response.Write "<INPUT Type=Text Size=40 Name=Item Value="""""">
  <BR>"
  End If
  
  %>
  
  <P>
  <INPUT Type="Submit" Name="Action" Value="Add Item to List">
  <INPUT Type="Submit" Name="Action" Value="Submit the List">
  <BR>
  
  <% End If %>
  
  </FORM>
  </BODY>
  </HTML>