
ASP留言板源代码:有主页,回复和删除三个版面。
主页包含主题,内容,姓名和e-mail,按下提交按钮会在下方显示留言内容。回复页面包含主题,内容和回复密码。删除页面输入密码可删除留言。代码谢谢...
主页包含主题,内容,姓名和e-mail,按下提交按钮会在下方显示留言内容。回复页面包含主题,内容和回复密码。删除页面输入密码可删除留言。
代码谢谢 展开
代码谢谢 展开
3个回答
展开全部
主程序
<html>
<head>
<title>业牧粞员?lt;/title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<script language="VBScript">
sub check()
if form.userid.value=empty then
msgbox "请输入您的昵称!"
focusto(0)
exit sub
end if
if form.email.value=empty then
msgbox "请输入您的E-mail地址!"
focusto(1)
exit sub
end if
if instr(form.email.value, "@")=0 then
msgbox "您的E-mail地址不正确,是不是记错了?再想想!"
focusto(1)
exit sub
end if
if form.content.value=empty then
msgbox "请输入您的留言内容!"
focusto(5)
exit sub
end if
form.submit
end sub
sub focusto(x)
document.form.elements(x).focus()
end sub
</script>
<body bgcolor="#CCFFCC" text="#333333">
<table width="90%" border="0" bordercolorlight="#E2F3F2" height="77" align="center">
<tr>
<td height="47" colspan="2" bgcolor="#00FFFF"><div align="center"> <font face="华文行楷" size="+6"><font color="#FF0000" face="行楷"><strong>留言本</strong></font></font>
</div> </td>
</tr>
<tr>
<td colspan="2" height="2">
<p align="center"><font face="隶书" size="+2"><font face="楷体_GB2312"><b><a href="show.asp"><font size="+1">查看留言</font></a></b></font>< /font></p>
</td>
</tr>
</table>
<table width="90%" border="0" align="center">
<tr bgcolor="#E2F3F2" align="center" valign="middle">
<td height="385">
<form action="show.asp" method="post" name="form" id="form">
<table align=center bgcolor=#E2F3F2 border=1
cellpadding=0 cellspacing=0 width="100%">
<tbody>
<tr bgcolor="#CCFFCC">
<td width=96 height="34"><div align="center"><font color="#0000FF">昵 称:</font></div></td>
<td width="441" height="34">
<input maxlength=30 name="userid">
<font color="#FF0000">* </font></td>
</tr>
<tr bgcolor="#CCFFCC">
<td width=96 height="35"><div align="center"><font color="#0000FF">伊妹儿:</font></div></td>
<td width="441" height="35" colspan=3>
<input type="text" name="email">
<font color="#FF0000">* </font></td>
</tr>
<tr bgcolor="#CCFFCC">
<td width=96 height="36"><div align="center"><font color="#0000FF">主 题:</font></div></td>
<td width="441" height="36" colspan=3>
<input maxlength=200 name=subject size=40></td>
</tr>
<tr bgcolor="#CCFFCC">
<td width=96 height="36"><div align="center"><font color="#0000FF">你的QQ:</font></div></td>
<td width="441" height="36" colspan=3>
<input name="qq" type="text" id="qq" maxlength="10"></td>
</tr>
<tr bgcolor="#CCFFCC">
<td width=96 height="37"><div align="center"><font color="#0000FF"> 你的主页:</font></div></td>
<td width="441" height="37" colspan=3>
<input name="site" type="text" id="site" value=""></td>
</tr>
<tr bgcolor="#CCFFCC">
<td width=96 height="147"><div align="center"><font color="#0000FF">留言内容:</font></div></td>
<td width="441" height="147" colspan=3>
<textarea cols=50 name=content rows=12></textarea></td>
</tr>
<tr align=middle bgcolor="#CCFFCC">
<td height="56" colspan=4>
<div align="center">
<input name=button1 type=button value=" 发 表 " onclick="check()">
<input name=button2 type=reset value=" 重 写 ">
</div></td>
</tr>
</tbody>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>
保存程序
<%@ language=VBScript%>
<html>
<head>
<title>保存留言</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#CCFFCC" text="#0000FF">
<p align="center"><strong><font color="#FF0000" size="+6" face="行楷">我的留言本</font></strong></p>
<%
'获得表单内的信息
userid = Request.Form ("userid")
title= Request.Form("subject")
site=Request.Form("site")
content= Request.Form("content")
email=Request.Form("email")
wtime=now()
from=Request.ServerVariables("REMOTE_ADDR")
email="<a href=mailto:" & email & ">" & email & "</a>"
if title="" then
title="无标题"
end if
On Error Resume Next
Application.Lock
'以ForAppending模式开启留言文件
set fso = CreateObject("Scripting.FileSystemObject")
'取得save和oldsave两个文件的完整路径
filepath=server.MapPath("save.txt")
oldfilepath=server.MapPath("oldsave.txt")
'将save改名为oldsave
fso.CopyFile filepath ,oldfilepath
'打开oldsave文件
set readf=fso.OpenTextFile(oldfilepath,1,true)
t=readf.ReadAll
'打开save文件
set showf=fso.CreateTextFile(filepath,true)
'将新的留言内容添加(append)到留言文件中
showf.WriteLine arrow & "<b>留言者</b>:" & userid & "<br>"
showf.WriteLine arrow & "<b>伊妹儿</b>:" & email & "<br>"
showf.WriteLine arrow & "<b>来自于</b>:" & from & "<br>"
showf.WriteLine arrow & "<b>发表日期</b>:" & wtime & "<br>"
showf.WriteLine arrow & "<b>留言者主页</b>:" & site & "<br>"
showf.WriteLine arrow & "<b>留言标题</b>:" & title & "<br>"
showf.WriteLine arrow & "<b>留言内容</b>:"& content & "<p>"
showf.WriteLine
showf.WriteLine "<hr>"
' 读出oldsave的内容,写入save中
showf.WriteLine t
'关闭oldsave文件
readf.Close
'删除oldsave文件
fso.DeleteFile oldfilepath,true
Application.UnLock
'顺便将留言内容输出到浏览器中
Response.Write "<h3>"
Response.Write "以下是 <i>" & userid & "</i> 的留言内容:"
Response.Write "</h3><hr>"
Response.Write arrow & "<b>来自于</b>:" & from & "<br>"
Response.Write arrow & "<b>伊妹儿</b> :" & email & "<br>"
Response.Write arrow & "<b>发表日期</b>:" & wtime & "<br>"
Response.Write arrow & "<b>留言者主页</b>:" & site & "<br>"
Response.Write arrow & "<b>留言标题</b>:" & title & "<br>"
Response.Write arrow & "<b>留言内容</b>:" & content & "<p>"
Response.Write "<hr>"
%>
<p align="center">点击<A href="show.asp"><font color="#FF00FF">这里</font></A>,<font color="#0000FF">查看所有留言!</font></p>
</body>
</html>
显示程序
@ language=VBScript%>
<html>
<head>
<title>所有留言</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#CCFFCC" text="#0000FF">
<p align="center"><font face="华文行楷" size="+6"><font color="#FF0000" face="行楷"><strong>留言本</strong></font></font> </p>
<hr>
<p align="center"> </p>
<%
on error resume next
set fso = CreateObject("Scripting.FileSystemObject")
filepath=server.MapPath("save.txt")
set showall=fso.OpenTextFile(filepath,1,true)
t=showall.ReadAll
Response.write(t)
showall.close
%>
</body>
</html>
<html>
<head>
<title>业牧粞员?lt;/title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<script language="VBScript">
sub check()
if form.userid.value=empty then
msgbox "请输入您的昵称!"
focusto(0)
exit sub
end if
if form.email.value=empty then
msgbox "请输入您的E-mail地址!"
focusto(1)
exit sub
end if
if instr(form.email.value, "@")=0 then
msgbox "您的E-mail地址不正确,是不是记错了?再想想!"
focusto(1)
exit sub
end if
if form.content.value=empty then
msgbox "请输入您的留言内容!"
focusto(5)
exit sub
end if
form.submit
end sub
sub focusto(x)
document.form.elements(x).focus()
end sub
</script>
<body bgcolor="#CCFFCC" text="#333333">
<table width="90%" border="0" bordercolorlight="#E2F3F2" height="77" align="center">
<tr>
<td height="47" colspan="2" bgcolor="#00FFFF"><div align="center"> <font face="华文行楷" size="+6"><font color="#FF0000" face="行楷"><strong>留言本</strong></font></font>
</div> </td>
</tr>
<tr>
<td colspan="2" height="2">
<p align="center"><font face="隶书" size="+2"><font face="楷体_GB2312"><b><a href="show.asp"><font size="+1">查看留言</font></a></b></font>< /font></p>
</td>
</tr>
</table>
<table width="90%" border="0" align="center">
<tr bgcolor="#E2F3F2" align="center" valign="middle">
<td height="385">
<form action="show.asp" method="post" name="form" id="form">
<table align=center bgcolor=#E2F3F2 border=1
cellpadding=0 cellspacing=0 width="100%">
<tbody>
<tr bgcolor="#CCFFCC">
<td width=96 height="34"><div align="center"><font color="#0000FF">昵 称:</font></div></td>
<td width="441" height="34">
<input maxlength=30 name="userid">
<font color="#FF0000">* </font></td>
</tr>
<tr bgcolor="#CCFFCC">
<td width=96 height="35"><div align="center"><font color="#0000FF">伊妹儿:</font></div></td>
<td width="441" height="35" colspan=3>
<input type="text" name="email">
<font color="#FF0000">* </font></td>
</tr>
<tr bgcolor="#CCFFCC">
<td width=96 height="36"><div align="center"><font color="#0000FF">主 题:</font></div></td>
<td width="441" height="36" colspan=3>
<input maxlength=200 name=subject size=40></td>
</tr>
<tr bgcolor="#CCFFCC">
<td width=96 height="36"><div align="center"><font color="#0000FF">你的QQ:</font></div></td>
<td width="441" height="36" colspan=3>
<input name="qq" type="text" id="qq" maxlength="10"></td>
</tr>
<tr bgcolor="#CCFFCC">
<td width=96 height="37"><div align="center"><font color="#0000FF"> 你的主页:</font></div></td>
<td width="441" height="37" colspan=3>
<input name="site" type="text" id="site" value=""></td>
</tr>
<tr bgcolor="#CCFFCC">
<td width=96 height="147"><div align="center"><font color="#0000FF">留言内容:</font></div></td>
<td width="441" height="147" colspan=3>
<textarea cols=50 name=content rows=12></textarea></td>
</tr>
<tr align=middle bgcolor="#CCFFCC">
<td height="56" colspan=4>
<div align="center">
<input name=button1 type=button value=" 发 表 " onclick="check()">
<input name=button2 type=reset value=" 重 写 ">
</div></td>
</tr>
</tbody>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>
保存程序
<%@ language=VBScript%>
<html>
<head>
<title>保存留言</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#CCFFCC" text="#0000FF">
<p align="center"><strong><font color="#FF0000" size="+6" face="行楷">我的留言本</font></strong></p>
<%
'获得表单内的信息
userid = Request.Form ("userid")
title= Request.Form("subject")
site=Request.Form("site")
content= Request.Form("content")
email=Request.Form("email")
wtime=now()
from=Request.ServerVariables("REMOTE_ADDR")
email="<a href=mailto:" & email & ">" & email & "</a>"
if title="" then
title="无标题"
end if
On Error Resume Next
Application.Lock
'以ForAppending模式开启留言文件
set fso = CreateObject("Scripting.FileSystemObject")
'取得save和oldsave两个文件的完整路径
filepath=server.MapPath("save.txt")
oldfilepath=server.MapPath("oldsave.txt")
'将save改名为oldsave
fso.CopyFile filepath ,oldfilepath
'打开oldsave文件
set readf=fso.OpenTextFile(oldfilepath,1,true)
t=readf.ReadAll
'打开save文件
set showf=fso.CreateTextFile(filepath,true)
'将新的留言内容添加(append)到留言文件中
showf.WriteLine arrow & "<b>留言者</b>:" & userid & "<br>"
showf.WriteLine arrow & "<b>伊妹儿</b>:" & email & "<br>"
showf.WriteLine arrow & "<b>来自于</b>:" & from & "<br>"
showf.WriteLine arrow & "<b>发表日期</b>:" & wtime & "<br>"
showf.WriteLine arrow & "<b>留言者主页</b>:" & site & "<br>"
showf.WriteLine arrow & "<b>留言标题</b>:" & title & "<br>"
showf.WriteLine arrow & "<b>留言内容</b>:"& content & "<p>"
showf.WriteLine
showf.WriteLine "<hr>"
' 读出oldsave的内容,写入save中
showf.WriteLine t
'关闭oldsave文件
readf.Close
'删除oldsave文件
fso.DeleteFile oldfilepath,true
Application.UnLock
'顺便将留言内容输出到浏览器中
Response.Write "<h3>"
Response.Write "以下是 <i>" & userid & "</i> 的留言内容:"
Response.Write "</h3><hr>"
Response.Write arrow & "<b>来自于</b>:" & from & "<br>"
Response.Write arrow & "<b>伊妹儿</b> :" & email & "<br>"
Response.Write arrow & "<b>发表日期</b>:" & wtime & "<br>"
Response.Write arrow & "<b>留言者主页</b>:" & site & "<br>"
Response.Write arrow & "<b>留言标题</b>:" & title & "<br>"
Response.Write arrow & "<b>留言内容</b>:" & content & "<p>"
Response.Write "<hr>"
%>
<p align="center">点击<A href="show.asp"><font color="#FF00FF">这里</font></A>,<font color="#0000FF">查看所有留言!</font></p>
</body>
</html>
显示程序
@ language=VBScript%>
<html>
<head>
<title>所有留言</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#CCFFCC" text="#0000FF">
<p align="center"><font face="华文行楷" size="+6"><font color="#FF0000" face="行楷"><strong>留言本</strong></font></font> </p>
<hr>
<p align="center"> </p>
<%
on error resume next
set fso = CreateObject("Scripting.FileSystemObject")
filepath=server.MapPath("save.txt")
set showall=fso.OpenTextFile(filepath,1,true)
t=showall.ReadAll
Response.write(t)
showall.close
%>
</body>
</html>

2024-07-26 广告
利信时代电源技术(北京)专业生产、销售页面投放URL-0。公司先后通过了ISO9001质量体系认证,ISO14001环境管理体系认证和OHSAS18001健康与安全管理体系认证,连年荣获“中国外商投资双优企业”、“沈阳市出口创汇十佳外商投资...
点击进入详情页
本回答由利信时代电源技术提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询