📄 通过asp处理表单.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0047)http://www6.163.com/it/item/0,2186,4989,00.html -->
<!-- Vignette StoryServer 4 Tue Feb 26 13:15:32 2002 --><HTML><HEAD><TITLE>IT</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type><!-- Vignette StoryServer 4 Fri Jun 30 09:33:27 2000 -->
<STYLE type=text/css>P {
FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 14pt
}
DIV {
FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 14pt
}
.p1 {
FONT-FAMILY: 宋体; FONT-SIZE: 9pt
}
.p2 {
FONT-FAMILY: 宋体; FONT-SIZE: 9pt; LINE-HEIGHT: 14pt
}
.p3 {
FONT-FAMILY: 宋体; FONT-SIZE: 14px
}
.p4 {
FONT-FAMILY: 宋体; FONT-SIZE: 14px; LINE-HEIGHT: 14pt
}
.p5 {
FONT-SIZE: 1pt
}
.headtable {
FONT-SIZE: 9pt
}
A:hover {
COLOR: red
}
A.t1:visited {
COLOR: red
}
</STYLE>
<META content="MSHTML 5.00.2919.6307" name=GENERATOR></HEAD>
<BODY aLink=#ff0000 bgColor=#ffffff link=#383098 text=#000000 topMargin=0
vLink=#336699><!-- Vignette StoryServer 4 Thu Nov 23 09:20:16 2000 -->
<TABLE border=0 cellPadding=0 cellSpacing=0 width=750>
<TBODY>
<TR>
<TD class=headtable height=54 width=200><A href="http://www.163.com/"><IMG
border=0 height=54 src="IT5.files/163logo.gif" width=160></A> <BR> <A
class=headtable href="http://freemail.yeah.net/"><FONT
color=#ff0000>赶快申请8M永久免费电子邮箱</FONT></A><BR> <A class=headtable
href="http://bj4.netease.com/feedback/jobs.html">网易公司诚聘英才</A> </A></TD>
<TD align=right class=headtable width=540><FONT
color=#ff0000>>></FONT><A
href="http://www.163.com/index.html">返回首页</A> <A
href="http://news.163.com/index.html"><FONT color=#ff0000>焦点新闻</FONT></A>
<A href="http://mall.163.com/">网易商城</A> <A
href="http://bj.163.com/">网易社区</A> <A
href="http://www.yeah.net/index.html">搜索引擎</A> <A
href="http://freemail.yeah.net/">免费邮件</A> <A
href="http://auctions.163.com/">网上拍卖</A> <A
href="http://www.163.com/serve/">个人服务</A><BR><!--Here is ad beginning.--><IFRAME
frameBorder=0 height=60 marginHeight=0 marginWidth=0 scrolling=no
src="IT5.files/site=www.163.htm" width=468
BORDERCOLOR="#000000"><SCRIPT LANGUAGE="JavaScript1.1" SRC=http://adserver.163.com/js.ng/site=www.163.com&category=it&type=banner></SCRIPT><NOSCRIPT><A HREF=http://ad1.163.com/click.ng/Params.richmedia=yes&site=www.163.com&category=it&type=banner><IMG SRC=http://ad1.163.com/image.ng/Params.richmedia=yes&site=www.163.com&category=it&type=banner></A></NOSCRIPT></IFRAME><!--Here is ad end.--></TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 height=10 width=740>
<TBODY>
<TR>
<TD><IMG border=0 height=0 src="IT5.files/dot.gif" width=0></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=750>
<TBODY>
<TR>
<TD width=70>
<TABLE border=0 cellPadding=0 cellSpacing=1 width="100%">
<TBODY>
<TR align=middle bgColor=#eeeeee>
<TD class=p1 height=20><A href="http://news.163.com/"><FONT
color=#000000>新闻</FONT></A></TD>
<TD class=p1><A href="http://sports.163.com/"><FONT
color=#000000>体育</FONT></A></TD></TR></TBODY></TABLE></TD>
<TD align=middle bgColor=#0036b2 class=p1 height=20 width=35><A
href="http://it.163.com/"><FONT color=#ffffff>电脑</FONT></A></TD>
<TD width=490>
<TABLE border=0 cellPadding=0 cellSpacing=1 width="100%">
<TBODY>
<TR align=middle bgColor=#eeeeee>
<TD class=p1 height=20><A href="http://game.163.com/"><FONT
color=#000000>游戏</FONT></A></TD>
<TD class=p1><A href="http://stock.163.com/"><FONT
color=#000000>财经</FONT></A></TD>
<TD class=p1><A href="http://house.163.com/"><FONT
color=#000000>房产</FONT></A></TD>
<TD class=p1><A href="http://culture.163.com/"><FONT
color=#000000>文化</FONT></A></TD>
<TD class=p1><A href="http://lady.163.com/"><FONT
color=#000000>女性</FONT></A></TD>
<TD class=p1><A href="http://movie.163.com/"><FONT
color=#000000>影视</FONT></A></TD>
<TD class=p1><A href="http://music.163.com/"><FONT
color=#000000>音乐</FONT></A></TD>
<TD class=p1><A href="http://life.163.com/"><FONT
color=#000000>生活</FONT></A></TD>
<TD class=p1><A href="http://travel.163.com/"><FONT
color=#000000>旅游</FONT></A></TD>
<TD class=p1><A href="http://science.163.com/"><FONT
color=#000000>科学</FONT></A></TD>
<TD class=p1><A href="http://health.163.com/"><FONT
color=#000000>健康</FONT></A></TD>
<TD class=p1><A href="http://jobs.163.com/"><FONT
color=#000000>职业</FONT></A></TD>
<TD class=p1><A href="http://education.163.com/"><FONT
color=#000000>教育</FONT></A></TD>
<TD class=p1><A href="http://spicy.163.com/"><FONT
color=#000000>新辣</FONT></A></TD></TR></TBODY></TABLE></TD><!--picture nav--><!--end picturenav-->
<TD align=right class=p1 vAlign=bottom width=155><FONT
color=#ff0000></FONT></TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=750>
<TBODY>
<TR>
<TD bgColor=#0036b2><SPACER height="1" type="block"></TR></TBODY></TABLE>
<TABLE>
<TBODY>
<TR>
<TD align=middle class=p1><A
href="http://all.163.com/it/pcdigest/index.htm">PCD个人网络手册</A> <A
href="http://www.163.com/it/item/0,2186,7448,00.html">Intel技术专题</A> <A
href="http://topsoft.163.com/software/">热门软件排行榜</A> <A
href="http://mobile.163.com/"><FONT color=red>手机站</FONT>全新改版</A> <A
href="http://all.163.com/it/popunet/study/10-1.htm">上网享受再教育</A> <A
href="http://gz.163.com/it2.htm">IT易:电脑频道广东版</A> <A
href="http://www.eshop.com.cn/">eNet导购专家</A> <A
href="http://all.163.com/it/hardbase/index.htm">硬件资料库</A> </TD></TR>
<TR>
<TD bgColor=#0036b2 class=p5 height=2 width=750>.</TD></TR>
<TR>
<TD height=4></TR></TBODY></TABLE>
<TABLE align=left border=0 cellPadding=0 cellSpacing=0 width=0>
<TBODY>
<TR>
<TD></TR></TBODY></TABLE>
<TABLE align=left border=0 cellPadding=4 cellSpacing=0 width=591>
<TBODY>
<TR>
<TD class=p2><A href="http://www6.163.com/it/index/0,2182,,00.html"><FONT
color=red>IT</FONT></A>>>><A
href="http://www6.163.com/it/category/0,2197,3,00.html"><FONT
color=red>软件时空</FONT></A>>>><A
href="http://www6.163.com/it/subcategory/0,2200,14,00.html"><FONT
color=red>编程指南</FONT></A>>>><FONT color=red>具体文章</FONT> </TD></TR>
<TR>
<TD align=middle class=p3 height=30><B>通过ASP处理表单</B>
<P align=center>周勇生 (03/24/2000)</P></TD></TR>
<TR>
<TD class=p2 width=591>
<P class=p3>
<P> 将输入的数据传送到服务器的方法,是使用HTML标记<form>...</form>的表单,在浏览器端输入数据,点击"submit"按钮后,将表单中输入的数据传送到服务器加以处理。表单的语法如下:<BR><BR><BR><BR> <form
action=url method=get|post name="formname" onreset=event1
<BR>onsubmit=event2<BR><BR>target=window> </form><BR><BR><BR><BR> ·action:处理输入的数据的站点服务器程序的url地址。<BR><BR> ·method:输入的数据传送到服务器的方式,如下:<BR><BR> get:将输入的数据加在action设定的url地址后面,传送到服务器<BR><BR> post:按照邮寄传输数据的方式,将输入的数据传送到服务器<BR><BR> ·name:设定form的名称<BR><BR> ·onreset:点击"reset"的按钮时执行所设定的子程序event1<BR><BR> ·onsubmit:点击"submit"的按钮是执行的子程序event2<BR><BR> ·target:指定输入数据结果所显示的窗口名称<BR><BR><BR><BR> 由表单的method可知,用户可以用如下的两种方法传送数据:<BR><BR><BR><BR> <B>1.get</B>:用户端将数据加到url后,格式为"?字段1=输入数据1&字段2=输入数据2&...",再将它送到服务器.譬如ACTION设为http://www.chinayancheng.net,字段Number的输入数据为001,字段Age的输入数据为23,则使用的get方法传给站点服务器的数据为http://www.chinayancheng.net?Number=001&Age=23.<BR><BR><BR><BR> <B>2.post</B>:用户端利用邮寄信息数据字段将数据传送到服务器。<BR><BR><BR><BR> 这种方法是使用Active
Server Pages一个内置的"对象"(object)---request,依据get,post方法而异:<BR><BR>get
:使用"输入数据=Request.querystring("字段名"),将附加于url后的 数据取出,以取得此字段的输入数据。<BR><BR>post:使用"输入数据=Request.form("字段名"),读取POST信息数据字段,以取得字段的输入数据。<BR><BR>下面我们来举一个例子,这个例子的表单使用Get方法,在用户端使用浏览器,把数据输入表单以后,点击"提交"按钮,将显示处理的结果。假设WEB服务器上ASP文件名为form.asp,它的源程序代码如下:<BR><BR><form
action="exec.asp" method="get"><BR><BR>姓名:<input type=text
name="aaa" value="姓名"><BR><BR><br>爱好:<BR><BR><select
name="bbb"><BR><BR><option>足球<BR><BR><option>篮球<BR><BR><option>羽毛球<BR><BR><option>象棋<BR><BR><option>看书<BR><BR><option>玩游戏<BR><BR></select><BR><BR><br><BR><BR><input
type=submit
value="提交"><BR><BR></form><BR><BR><BR><BR> 点击"提交"按钮后,执行WEB服务器的exec.asp脚本文件,exec.asp文件的源程序代码如下,由于表单(form)使用get方式,源程序代码使用"输入数据=request.querystring("字段名"),将附加于URL后的数据取出,以取得此段的输入数据:<BR><BR><html><body><BR><BR><%=request.querystring("aaa")%>你好,你的爱好是<BR><BR><%=request.querystring("input2")%><BR><BR></body></html>
<!-- #EndEditable --></P><BR><!-- Vignette StoryServer 4 Tue Aug 15 17:42:01 2000 -->
<SCRIPT language=JavaScript>function recommendNew(){ OpenWindow = window.open('http://talkshow.163.com/recommend.php?referer='+parent.location,'recWin','toolbar=no,scrollbars=no,menubar=no,width=470,height=470')}</SCRIPT>
<P><A href="javascript:recommendNew()">请点此将本文推荐给你的好友!</A></P></TD></TR>
<TR>
<TD class=p2><A href="mailto:it@staff.163.com?subject=通过ASP处理表单"><FONT
color=red>有话要说?请给我们来信!</FONT></A> </TD></TR>
<TR>
<TD align=right></TD></TR>
<TR>
<TD align=middle bgColor=#f2f2f2 class=p4 colSpan=2
width=591><B>相关文章</B></TD></TR>
<P>
<TR>
<TD class=p2 vAlign=top width=591>
<UL>
<LI><A
href="http://www6.163.com/it/item/0,2186,1172,00.html">ASP实现中文虚拟域名(1)</A>
</LI></UL>
<TR>
<TD class=p2 vAlign=top width=591>
<UL>
<LI><A
href="http://www6.163.com/it/item/0,2186,2020,00.html">最新ASP基础教程</A></A>
</LI></UL>
<TR>
<TD class=p2 vAlign=top width=591>
<UL>
<LI><A
href="http://www6.163.com/it/item/0,2186,683,00.html">最简单的ASP聊天室</A>
</LI></UL>
<TR>
<TD class=p2 vAlign=top width=591>
<UL>
<LI><A
href="http://www6.163.com/it/item/0,2186,628,00.html">15种asp使用技巧</A>
</LI></UL>
<TR>
<TD class=p2 vAlign=top width=591>
<UL>
<LI><A
href="http://www6.163.com/it/item/0,2186,629,00.html">如何在ASP中实现PING</A></LI></UL></P></TBODY></TABLE>
<TABLE align=left border=0 cellPadding=0 cellSpacing=0 height=400 width=8>
<TBODY>
<TR>
<TD></TR></TBODY></TABLE><!-- Vignette StoryServer 4 Mon Nov 20 09:36:25 2000 -->
<TABLE align=left border=0 cellPadding=0 cellSpacing=0 width=150>
<TBODY>
<TR>
<TD>
<TABLE border=0 cellPadding=0 cellSpacing=2 width=150>
<TBODY>
<TR>
<TD align=middle class=p3 height=20><A href="http://www.163.com/it"
onclick="window.external.addFavorite('http://www.163.com/it','网易IT频道');return false"
title=网易IT频道><FONT
color=red>把本频道加入书签!</FONT></A></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD bgColor=#4274de>
<TABLE border=0 cellPadding=0 cellSpacing=1 width="100%">
<TBODY>
<TR>
<TD>
<TABLE bgColor=#ffffff border=0 cellPadding=0 cellSpacing=0
width="100%"><!--Begin the system software-->
<TBODY>
<TR>
<TD align=middle bgColor=#4274de class=p4 colSpan=2><A
href="http://www6.163.com/it/category/0,2197,1,00.html"><FONT
color=#ffffff>IT瞭望</FONT></A></TD></TR>
<TR>
<TD bgColor=#000000 colSpan=2><SPACER height="1"
type="block"></TD></TR>
<TR>
<TD align=middle class=p2 width="50%"><A
href="http://www6.163.com/it/subcategory/0,2200,4,00.html"><FONT
color=#000000>业界动态</FONT></A> </TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -