日期:2014-05-17  浏览次数:20824 次

一个例子里Request对象的Form集合,运行却提示错误
依然是一个教程里的例子,但不知是哪里出错了
<html>     
<head>
<title> 兴趣和爱好 </title>
</head>     
<body>     
<p> 请填写你的爱好 </p>     
<form   method= "get "   action= "form.asp ">     
<p> <input   type= "text "   name= "hobby "   size= "20 "> <br>     
<input   type= "checkbox "   name= "hobby "   value= "   足球   ">   足球  
<input   type= "checkbox "   name= "hobby "   value= "   乒乓球   ">   乒乓球   </p>     
<p> <input   type= "submit "   value= "   发送 "   name= "B1 "> <input   type= "reset "   value= "   重填 "   name= "B2 "> </p>     
</form>     
<%
  For   each   i   in   Request.Form( "hobby ")
  Response.Write   i   &   " <br> "
        Next
%>     
</body>
</html>


出错信息是:
错误类型:
Microsoft   VBScript   编译器错误   (0x800A0408)
/MyWeb/sample6-02.asp,   第   15   行
  For   each   i   in   Request.Form( "hobby ")


------解决方案--------------------
For each i in Request.Form( "hobby ")前面是全角空字符,删除即可,如下:

<%
For each i in Request.Form( "hobby ")
Response.Write i & " <br> "
Next
%>