本留言板以ASP编写,需要FSO组件支持,最大的特点就是简单易用。她采用单文本文件(Content.txt,第一次留言后产生)来保存留言,程序本身(MsgBoard.asp,文件名请勿随意修改)也只有一个文件,可将最近发表的留言显示在最上面,适合于像我一样的初学者学习,希望你喜欢。版权没有,翻版不究。^_^
<
center
>
<
h2
><
ahref
=
"
http://blog.youkuaiyun.com/t0nsha/
"
target
=
"
_blank
"
>
t0nsha
</
a
>
'
s<ahref="#留言">留言</a>板v1.0</h2>
</
center
>
<
hrcolor
=
"
#00FF00
"
>

<
%
'
Getthetotallinesofafile.
Function
GetLine(filename)
Const
ForReading
=
1
,ForWriting
=
2
Dim
fso,f,ra
Set
fso
=
Server.CreateObject(
"
Scripting.FileSystemObject
"
)
Set
f
=
fso.OpenTextFile(filename,ForReading)
ra
=
f.ReadAll
GetLine
=
f.Line
f.Close()
EndFunction
%
>

<
%
'
Showthefilebottomup
Function
ShowRev(filename)
'
Setfso=Server.CreateObject("Scripting.FileSystemObject")
'
Setf=fso.OpenTextFile(filename,1)
i
=
GetLine(filename)
-
1
While
i
>
0
i
=
i
-
3
j
=
i
Set
fso
=
Server.CreateObject(
"
Scripting.FileSystemObject
"
)
Set
f
=
fso.OpenTextFile(filename,
1
)
While
j
>
0
f.SkipLine()
j
=
j
-
1
Wend
For
k
=
1
To
3
rl
=
f.ReadLine()
rl
=
Server.HTMLEncode(rl)
Response.Write(rl
&
"
<br>
"
)
Next
f.Close()
Wend
End
Function
%
>

<
%
Dim
fso
Set
fso
=
CreateObject
(
"
Scripting.FileSystemObject
"
)
If
Request.Form(
"
szName
"
)
=
""
Then
Response.Write(
"
<fontcolor='#FF0000'>
"
&
"
昵称不能为空!
"
&
"
</font>
"
&
"
<br>
"
)
ElseIf
Request.Form(
"
szContent
"
)
=
""
Then
Response.Write(
"
<fontcolor='#FF0000'>
"
&
"
内容不能为空!
"
&
"
</font>
"
&
"
<br>
"
)
Else
If
Not
fso.FileExists(Server.MapPath(
"
Content.txt
"
))
Then
Set
fil
=
fso.CreateTextFile(Server.MapPath(
"
Content.txt
"
),
True
)
Else
Set
fil
=
fso.OpenTextFile(Server.MapPath(
"
Content.txt
"
),
8
)
End
If
fil.WriteLine(
Now
&
"
来自:
"
&
Request.ServerVariables(
"
REMOTE_ADDR
"
)
&
"
的
"
&
Request.Form(
"
szName
"
)
&
"
说:
"
)
fil.WriteLine(Request.Form(
"
szContent
"
))
fil.WriteBlankLines(
1
)
fil.Close
End
If
If
fso.FileExists(Server.MapPath(
"
Content.txt
"
))
Then
Call
ShowRev(Server.MapPath(
"
Content.txt
"
))
End
If
%
>

<
hrcolor
=
"
#00FF00
"
>

<
formname
=
"
form1
"
method
=
"
post
"
action
=
"
MsgBoard.asp
"
>
昵称(限字20):
<
inputtype
=
"
text
"
maxlength
=
20
size
=
'
20%'name="szName"><br>
内容(限字80):
<
inputtype
=
"
text
"
maxlength
=
80
size
=
'
80%'name="szContent">
<
inputtype
=
"
submit
"
name
=
"
Submit
"
value
=
"
发表留言
"
>
</
form
>

<
aname
=
"
#留言
"
></
a
>
下载地址1:http://down.chinaz.com/soft/21102.htm
下载地址2:http://www.fs2you.com/files/2167af14-9c93-11dc-8f79-00142218fc6e/
这是一个简单的ASP留言板程序,使用FSO组件支持,适用于初学者学习。留言板采用单文本文件保存留言,并可将最新留言显示在最上方。
2908

被折叠的 条评论
为什么被折叠?



