帮我看一错在那里呢?问题解决就给分!!
这是一个留言本处理页面,但是运行时总是出错,请指点!!
<%
' 读取各输入框的数据
Name = Request("Name")
Email = Request("Email")
Subject = Request("Subject")
Memo = Request("Memo")
' 检查各输入框是否输入有数据
If Name = "" Or Email = "" Or Subject = "" Or Memo = "" Then
Response.Write "输入框不能为空白!"
Response.End '不再处理以下的程序
End of
' 第一行包含“姓名”与“Email”
Line1 = "留言人:" & Name
Line1 = Line1 & String(5, " ") ' 插入5个汉字空格
Email = "<A HREF=mailto:" & Email & ">" & Email & "</A>"
Line1 = Line1 & "Email" & Email & "<BR>"
' 第二行
Line2 = "主 题:" & Subject & "<BR>"
' 第三行为“留言”,先将留言中的换行符vbCrLf 换成<BR>
Memo = Replace( Memo, vbCrLf, "<BR>" )
' 为了显示不同的背景颜色,采用表格输出
Line3 = "<TABLE BORDER=0 BGCOLOR=#00FFFF><TR><TD>"
Line3 = Line3 & Memo & "</TD></TR></TABLE>"
' 第四行为留言“时间”
Line4 = "时 间:" & Now()
On Error Resume Next ' 忽略所有的错误
' 建立 FileSystemObject对象
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Application.Lock
' 取得gbook.txt及gbookold.txt的完整路径
FilePath = Server.MapPath("gbook.txt")
OldFilePath = Server.MapPath("gbookold.txt")
' 将 gbook.txt 更名为 gbookold.txt
fso.MoveFile FilePath, OldFilePath
' 打开 gbookold.txt
Set fin = fso.OpenTextFile(OldFilePath, , True)
' 建立 gbook.txt
Set fout = fso.CreateTextFile(FilePath)
' 写入访问者留言
fout.WriteLine Line1
fout.WriteLine Line2
fout.WriteLine Line3
fout.WriteLine Line4
fout.WriteLine "<HR>"
' 一次读取整个gbookold.txt,然后写入gbook.txt
fout.WriteLine fin.ReadAll
' 关闭 gbookold.txt
fin.Close
' 删除 gbookold.txt
fso.DeleteFile OldFilePath, True
Application.UnLock
' 将网页导至“浏览留言”的网页gbook.asp
Response.Redirect "gbook.asp"
%>