·您的位置: 首页 » 资源教程 » 编程开发 » ASP » 动态添加FORM项

动态添加FORM项

类别: ASP教程  评论数:0 总得分:0
<%@ 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>
-= 资 源 教 程 =-
文 章 搜 索
关键词:
类型:
范围:
纯粹空间 softpure.com
Copyright © 2006-2008 暖阳制作 版权所有
QQ: 15242663 (拒绝闲聊)  Email: faisun@sina.com
 纯粹空间 - 韩国酷站|酷站欣赏|教程大全|资源下载|免费博客|美女壁纸|设计素材|技术论坛   Valid XHTML 1.0 Transitional
百度搜索 谷歌搜索 Alexa搜索 | 粤ICP备19116064号-1