请帮忙调试代码!

 1<html>
 2<body><form action="trans.asp" method="post">姓名:<input name="username" type="text"/><br/>   
 3性别:<select name="sex">
 4<option>男</option>
 5<option>女</option>
 6</select><br/>   
 7留言:<textarea name="message">你好!   
 8注意多行文本的处理。</textarea><br/>   
 9爱好:(按住ctrl键可以多选)<select mutiple="" name="hobby" size="4">
10<option>运动</option>
11<option>乒乓球</option>
12<option>羽毛球</option>
13<option>电脑</option>
14</select><br/>
15<input name="submit" type="submit" value="提交"/><input name="submit2" type="reset" value="重设"/></form></body></html>
1@ language=vbscript 
1 response.expires=0 
1   
2option explicit   
3dim username,sex,hobby,message,messagep,i   
4username=trim(request.form("username"))   
5sex=trim(request.form("sex"))   
6' hobby=trim(request.form("hobby"))   
7message=trim(request.form("message"))   
8messagep=replace(message,vbcrlf,"

<br/>

1" & vbcrlf)   
 1<html>
 2<body>   
 3姓名:```
 4 =username 
 5```<br/>   
 6性别:```
 7 =sex 
 8```<br/>   
 9留言:```
10 =message 
11```<br/>   

=messagep

1实际上提交按钮的值也被传递<br/>```
2 =request.form("submit") 
3```<br/>   
4共选择爱好项目数:```
5 =request.form("hobby").count 
6```<br/>   

for i=1 to request.form("hobby").count
response.write request.form("hobby")(i)
next

为什么当我在运行form.asp,运行完以后当我要把信息提交时却产生了如下错误,为什么呢?Microsoft VBScript 编译器错误 错误 '800a0400'

缺少语句

/cqfloinform/trans.asp, 行4

option explicit

请帮忙!其中form.asp与trans.asp是位于同一个文件目录下的。

第二个问题:form name="ADDUser" method="POST" action="adduser.asp" onSubmit="return CheckForm();">中的onsubmit什么功能?是一提交就执行checkform()吗?

---------------------------------------------------------------

Option Explicit
说明
如果使用 Option Explicit,该语句必须出现在 Script 的任何过程之前。
使用 Option Explicit 语句时,必须使用 Dim、Private、Public 或 ReDim 语句显式声明所有变量。如果试图使用未经声明的变量名,则会出现错误。
--------------------------------------------------------------------------------

提示 可用 Option Explicit 避免拼错已存在的变量名称。对于作用范围不清楚的变量,使用此语句可避免发生混淆。

---------------------------------------------------------------

用楼上的方法试一下
onsubmit是触发脚本检查表单的
---------------------------------------------------------------

把Option Explicit 的位置往前挪

Published At
Categories with Web编程
Tagged with
comments powered by Disqus