如何动态添加Form项?

栏目: 编程语言 · 发布时间: 8年前

内容简介:如何动态添加Form项?

<%@ language = vbscript%>
<% Response.Expires = 0 %>
<html>
<head>
<title>
星河影动之动态添加Form</title>
</head>
<body>
<%
If Request("Action") = "
提交列表" Then
Response.Write "<B>
提交的项:</B><BR>"

' 显示输入的内容.
nItems = Request.Form("Items").Count
For i = 1 To nItems
Response.Write Request.Form("Items")(i) & "<BR>"

' 显示提交的项.
Next
Response.Write Request("Item") & "<BR>"
Else
'
为所有的项创建Form.

 %>
<FORM Action=dynaform.asp Method=Post>
<B>
:</B><BR>
<%
nItems = Request.Form("Items").Count
For i = 1 To nItems
Response.Write "<INPUT Type=Text Name=Items Value=""" & _
Trim(Request.Form("Items")(i)) & """><BR>"

' 显示前面已提交的项.
Next

If Request.Form("Item") <> "" Then
Response.Write "<INPUT Type=Text Name=Items Value=""" & _
Trim(Request.Form("Item")) & """><BR>"

' 保存已输入的项,再生成一个新的输入框.

Response.Write "<P>
请输入项,并点击"添加项到列表"按钮提交<BR>"
Response.Write "<INPUT Type=Text Size=50 Name=Item Value="""""">"
Else
Response.Write "<P>
请输入项,并点击"添加项到列表"按钮提交Please enter an Item,<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>

 

[1]


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

WebWork in Action

WebWork in Action

Jason Carreira、Patrick Lightbody / Manning / 01 September, 2005 / $44.95

WebWork helps developers build well-designed applications quickly by creating re-usable, modular, web-based applications. "WebWork in Action" is the first book to focus entirely on WebWork. Like a tru......一起来看看 《WebWork in Action》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

html转js在线工具
html转js在线工具

html转js在线工具