'/*DynamicAddForm.asp文件的源代码开始点*/<%@ Language=VBScript %><%'----------------------------------------------'Author : WaiWai(歪歪)'Created Date : 2000-2-20'File Name : DynamicAddForm.ASP'Description : Dynamic Add Form's Text Fields.'All Rights Reserved.所有权归City Club.'----------------------------------------------%><HTML><HEAD><META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"><title>Dynamic Add Form Text Elements.</title><style type="text/css"><!--td { font-size: 9pt}body { font-size: 9pt}select { font-size: 9pt}A {text-decoration: none; color: #003366; font-size: 9pt}A:hover {text-decoration: underline; color: #FF0000; font-size: 9pt}--></style></HEAD><BODY><table border="1" cellspacing="0" height=400 width=98% bordercolorlight="#5E5E00" bordercolordark="#FFFFEC" bgcolor=LightGrey align=center valign=top> <%if trim(Request.Form("List")) = "显示已有项" then '/*其中的trim()函数是去掉Request.Form("List")两边的空格*/ '/*当您点击了名为"显示已有项"的按钮时,我们将会看到所有已经有值的类型为text的form项*/Response.Write "<td><form><center>已经存的元素内容是:" & "</td><tr>" for I = 1 to Request.Form("items").Count '/*已经存在的Text类型的数目*/Response.Write "<td align=center>" & Request.Form("items")(I) & "</td><tr>"nextif trim(Request.Form("newItem"))<>"" thenResponse.Write "<td align=center>" & trim(Request.Form("newItem")) Response.write "<input type=button name='Back' value='Back' Response.write "style='font-size:12pt' onClick='window.history.back()'>'/*点击了<Back>按钮后就会返回上一页,也就是添加类型为text的Form项所在的页*/Response.write "</form></td><tr>"end ifelse '/*此时表明用户是点击了名为"添加"按钮,要进行添加操作*/Response.Write "<td align=center><form action=DynamicAddForm.asp method=post></td>"for I = 1 to Request.Form("items").Count '/*此时的操作是循环显示出已经存在且产有值的类型为text的form元素*/'/*Request.Form("items").Count为已经存在的Text类型的数目*/'/*我们可以在此处加入对所添加内容的条件判断。如判断所添加内容的长度是否小于3等.*/Response.Write "<td align=center><input type=text name=items value='"Response.write Request.Form("items")(I) & "'></td><tr>"'/*此步是将所得到某一有值的类型为text的form元素的值显示出来*/nextif trim(Request.Form("newItem")) <> "" then'/*此步的目的是检查是否用户在添加新的类型为text的form元素处有没有添加新值,*/'/*有则将此值赋给name=items的类型为text的form元素,并显示出来。*/Response.Write "<td align=center><input type=text name=items value='"Response.Write trim(Request.Form("newItem")) & "'"Response.Write "><br></td><tr>"Response.Write "<td align=center><input type=text name=newItem" Response.write "value=''></td><tr>"'/*此处是添加一个名为newItem类型为text的form元素,让用户可以继续进行添加操作。*/else '/*此时表明用户在添加新的类型为text的form元素处并没有添加新的值,所以就只能列出*/'/*一个名为newItem类型为text的form元素,让用户可以继续进行添加操作。*/Response.Write "<td align=center><input type=text name=newItem value=''></td>"end if%><tr><td align=center><br><input type=submit name="List" value="显示已有项" style="font-size:12pt"><input type=submit name="Add" value="添加" style="font-size:12pt"> </form></td><%end if%></table></BODY></HTML>'/*DynamicAddForm.asp文件的源代码结束点*/ |
'/*DynamicAddForm2.asp文件的源代码开始点*/<%@ Language=VBScript %><%'----------------------------------------------------'Author : WaiWai(歪歪)'Created Date : 2000/1/13'File Name : DynamicAddForm.ASP'Description : Dynamic Add Form's Text Fields.'All Rights Reserved.所有权归City Club'----------------------------------------------------%><HTML><HEAD><META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"></HEAD><style type="text/css"><!--td { font-size: 9pt}body { font-size: 9pt}select { font-size: 9pt}A {text-decoration: none; color: #003366; font-size: 9pt}A:hover {text-decoration: underline; color: #FF0000; font-size: 9pt}--></style><title>Add new mail server site. All Rights Reserved.</title><script language=javascript>function mycheck(tt) {alert("afd")return false}</script><BODY topmargin=12><form name=form1 method=post><table border="1" cellspacing="0" height=400 width=98% bordercolorlight="#5E5E00" bordercolordark="#FFFFEC" bgcolor=LightGrey align=center valign=top><td align=center colspan=5 valign=top height=30><h4>追加新邮件服务器信息</h4></td><tr><td align=center valign=top height=10><font style="font-size:11pt">条数</font></td><td align=center valign=top height=10 width=43%><font style="font-size:11pt">邮件服务器URL</font></td><td align=center valign=top height=20 width=17%><font style="font-size:11pt">用户名参数变量</font></td><td align=center valign=top height=20 width=17%><font style="font-size:11pt">密码参数变量</font></td><td align=center valign=top height=20 width=17%><font style="font-size:11pt">站点名称</font></td><tr><td colspan=5 valign=top height=30><font color=blue>[ * * * Example: * * * ]<br>0. 990.net/prog/login? user pass 990.net</font></td><tr><%if trim(Request.form("num"))="" then '/*此时表示用户首次打开此ASP页,所以所得的num为空,并显示出相应的输入界面供用户输入信息'其中的num值是为来记录类型为text的form元素的数目,与第一个代码文件中的 'request.form("items").Count效果一样.*/'/*First time open this page.*/Response.Write "<td align=center valign=top>1.</td>"Response.Write "<input type=hidden name=num value=1>"Response.Write "<td align=center valign=top >"Response.Write " <input type=text size=40 name=url1></td>"Response.Write "<td align=center valign=top > <input type=text size=12 id=text1 name=user_var1></td>" & vbcrlfResponse.Write "<td align=center valign=top > <input type=text size=12 id=text2 name=pw_var1></td>"Response.Write "<td align=center valign=top > <input type=text size=12 id=text2 name=sitename1></td><tr>"else'/*Add new*/'Response.Write "<td align=center valign=top>" & trim(Request.Form("num")) & ".</td>"'/*Loop Start*/Response.Write "<td colspan=5 valign=top>"for I = 1 to cint(trim(Request.Form("num")))+1%><%=I%>.<%if I<10 then '/*此处的目的是为了保证前10个元素与后89个元素缩进相同的宽度*/%> <%elseif I<100 and I>9 then%> <%end if%><%if I<>cint(trim(Request.Form("num")))+1 thenurl="url" & I '/*生成如url1,url2......的字符串*/user_var = "user_var" & Ipw_var = "pw_var" & Isitename = "sitename" & Iif trim(request.form(url))<>"" and trim(Request.Form(user_var))<>"" and_ trim(Request.Form(pw_var))<>"" and trim(Request.Form(sitename))<>"" then %> <input type=text size=40 name=<%=url%> value=<%=trim(request.form(url))%>> <input type=text size=12 id=text1 name=<%=user_var%> value=<%=trim(Request.Form(user_var))%>> <input type=text size=12 id=text2 name=<%=pw_var%> value=<%=trim(Request.Form(pw_var))%>> <input type=text size=12 id=text2 name=<%=sitename%> value=<%=trim(Request.Form(sitename))%>><br><% else%><script>alert("邮件服务器URL、用户名参数变量、密码参数变量、站点名称中有空值!")window.history.back()</script><% exit forend ifelse%> <input type=text size=40 name=url<%=I%>> <input type=text size=12 id=text1 name=user_var<%=I%>> <input type=text size=12 id=text2 name=pw_var<%=I%>> <input type=text size=12 id=text2 name=sitename<%=I%>><br> <%end ifnext'/*Loop End*/end if%></td><tr><td colspan=5 align=center height=20><input type=button value="追加" style="font-size:11pt"onclick="{document['form1'].action='DynamicAddForm.ASP';document.form1.submit();}"> <input type=Button value="保存" style="font-size:11pt"onclick="document['form1'].action='SaveNew.asp';document.form1.submit();"> <input type=button value="返回控制台" style="font-size:11pt"onClick="window.location='PostOfficeConsole.asp'"></td></table><%if trim(Request.Form("num"))<>"" then '/*当开始给第一个类型为text的form元素添加了值的时候开始记录text类型元素的数目*/%><input type=hidden name=num value=<%=cint(trim(Request.Form("num")))+1%>><%end if%></form></BODY></HTML>'/*DynamicAddForm2.asp文件的源代码结束点*/ |