设为首页收藏本站

新微赢技术网

 找回密码
 注册
搜索
热搜: 回贴
查看: 164|回复: 4
打印 上一主题 下一主题

如何动态添加form项

[复制链接]
跳转到指定楼层
1#
发表于 2009-3-16 20:00:59 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<%@ 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>
2#
发表于 2010-2-10 04:05:06 | 只看该作者
那个贴子 让它沉下去吧! 不要啦
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

申请友链|小黑屋|最新主题|手机版|新微赢技术网 ( 苏ICP备08020429号 )  

GMT+8, 2024-11-19 06:23 , Processed in 0.092013 second(s), 8 queries , Gzip On, Memcache On.

Powered by xuexi

© 2001-2013 HaiAn.Com.Cn Inc. 寰耽

快速回复 返回顶部 返回列表