如何使用ASP制作模似动态生长的表单?
2000-11-03 10:11:17 来源:WEB开发网核心提示:FILE: DYNAFORM.asp<%@ language = vbscript%><% Response.Expires = 0 %><HTML><HEAD><TITLE>Dynamically Growing Form</TITLE><
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>
<%@ 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>
[]
更多精彩
赞助商链接