一、ASP留言板源代码:有主页,回复和删除三个版面。
主程序
<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>
二、求ASP源码!最好是整站的!功能要多!
Active Server Pages(ASP,活动服务器页面)就是一个编程环境,在其中,可以混合使用HTML、脚本语言以及组件来创建服务器端功能强大的Internet应用程序。如果你以前创建过一个站点,其中混合了HTML、脚本语言以及组件,你就可以在其中加入ASP程序代码。通过在HTML页面中加入脚本命令,你可以创建一个HTML用户界面,并且,还可以通过使用组件包含一些商业逻辑规则。组件可以被脚本程序调用,也可以由其他的组件调用。
文章分享结束,分享160个ASP源码,总有一款适合您和求ASP源码!最好是整站的!功能要多!的答案你都知道了吗?欢迎再次光临本站哦!