博客园  :: 首页  :: 新随笔  :: 订阅 订阅  :: 管理

<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="gb2312" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>

<script language="vb" runat="server">
sub getformnamevalue(byval nvcoll as namevaluecollection)
dim i,j as integer
dim nvarr(),val() as string
nvarr=nvcoll.allkeys '获取表单所有变量名
for i=0 to nvarr.getupperbound(0) 
 response.Write("表单变量名为:" & nvarr(i)) ‘'输出第i个变量名
 val = nvcoll.getvalues(nvarr(i)) '输出第i个变量值集
 for j = 0 to val.getupperbound(0)
  response.Write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;值为:" & val(j))
 next j
response.Write("<br>")
next i
end sub
sub page_load(sender as object,e as eventargs)
 dim formnvcoll as namevaluecollection
 if request.httpmethod = "post" then
  response.Write("执行post处理!<br>")
  formnvcoll = request.Form
 else
  if request.httpmethod = "get" then
   response.Write("执行GET处理!<br>")
   formnvcoll = request.QueryString
  end if
 end if
end sub
</script>
</head>
<body>
  <form action="index1.aspx" method="post">
     <p>您的姓名:<input type=text name="Name"><br>
     <p>您的年龄:<input type=text name="Age"><br>
     <p>您的性别:<input type=radio name="Sex" value="男" checked>男
                  <input type=radio name="Sex" value="女">女<br>
     <p>您的爱好:<input type=checkbox name="travel" value="yes">旅游
                  <input type=checkbox name="reading" value="yes">读书
                  <input type=checkbox name="music" value="yes">听音乐<br><br>
     <input type="submit" value="提交" name="OK">
     <input type="reset" value="重输" name="re-input">
  </form>
</body>
</html>