本來是想用集合的方式來讀取request.form 信息的,但是不知道為什么,啥都不顯示,麻煩給點高見蠻!!


<%@ 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>


注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
粤ICP备14056181号  © 2014-2021 ITdaan.com