
<link href="//css/usercss" rel="stylesheet" type="text/css">
<script language="JavaScript" src="//js/commonjs"></script>
<script language="JavaScript" src="//js/ubbcodejs"></script>
<script language="JavaScript">
function formCheck()
{
if (documenttheformnicknamevalue == "")
{
alert("请填写名字。");
documenttheformnicknamefocus();
return false;
}
if (documenttheformcontentvalue == "")
{
alert("请填写留言内容。");
documenttheformcontentfocus();
return false;
}
theformSubmitdisabled=true;
return true;
}
function showimage()
{
documentimagesfaceimgsrc=face_image[parseInt(documenttheformfaceoptions[documenttheformfaceselectedIndex]value)];
}
<body background=">
创建一个asp文件,里面创建留言标题,留言人信息,手机号,留言内容等,使用代码连接数据库,代码如下。
<%Dim Database
Database="datamessage"
Dim Conn,ConnStr
Set conn = ServerCreateObject("ADODBConnection")
ConnStr="Provider=sqloledb;Server=localhost;database="&Database&";uid=sa;pwd="
Connopen ConnStr
%>
再次新建一个名为:defaultasp的文件,这个文件是显示和添加留言的页面
编码也需要改为GB2312
在这里输入的代码如下:
<!--#include file="connasp"--><%
if request("action")="addmessagesave" then
if trim(request("memo"))="" then
ResponseWrite("<script lanuage=javascript>alert('留言内容不能为空!');location='messageasp'</script>")
responseEnd()
End if
set rsa=ServerCreateObject("ADODBRecordSet")
strsqla="select from [message]"
rsaopen strsqla,conn,3,2
rsaaddnew
rsa("memo")=request("memo")
rsa("time1")=now
rsaupdate
ResponseWrite("<script lanuage=javascript>alert('留言成功!');location='messageasp'</script>")
responseEnd()
End if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 10 Transitional//EN" ";
新建一个管理留言的页面,名为manageasp
同样先改编码为GB2312去掉原来的代码重新输入新的代码如下:
<!--#include file="connasp"--><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 401 Transitional//EN" ";
运行调式程序
打开一个IE浏览器
输入:>
地址
就可以进入到留言板界面,进行留言了
点击左边的留言管理,就可以进入留言管理界面,在留言管理界面可以回复和删除留言信息。
以上就是关于编写一个asp留言板源代码全部的内容,包括:编写一个asp留言板源代码、dreamweaver,asp怎么制作留言板、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)