ajax 好久没有写过asp了,这回写个留言板还真觉得有点难度,竞然写了整整一天,哈哈. 演示的留言板,希望各位大哥大姐如果发现有漏洞的话请在这里告诉我,千万不要黑我的网站,在这里小弟先谢过了. index.asp BLL_Guest.asp Privatemycom,mymod,mydal PrivateLI,UL PrivateDEL mydal.GetGuest(Id) EndSub '新增信息 Callmydal.Insert(mymod) EndSub '更新信息 Callmydal.Update(mymod) EndSub '删除信息 mydal.Delete(Request("Id")) EndSub '查找信息 DimPageSize,CurrentPage,WhereValue,OrderValue,RecordCount FindByPage=tmp2 EndFunction PrivateSubClass_Initialize() LI="<li><span>{0}</span><span>{1}</span><br/><span>作者:{2}</span><span>{3}</span><span>{4}</span></li>"&vbCrLf Setmycom=newCommon EndSub PrivateSubClass_Terminate() Setmycom=Nothing EndSub EndClass DAL_Guest.asp
就只有留言其它的都什么也没写,采用三层结构(不知道算不算,本来对三层的概念很糊涂)
<%codepage=65001%>
<%
optionexplicit
%>
<%Response.Charset="utf-8"%>
<%Session.CodePage=65001%>
<!--#includefile="AccHelper.asp"-->
<!--#includefile="Common.asp"-->
<!--#includefile="DAL_Guest.asp"-->
<!--#includefile="MOD_Guest.asp"-->
<!--#includefile="BLL_Guest.asp"-->
<%
Dimmybll
DimmyList
Setmybll=newBLL_Guest
SelectCaseRequest("tCMD")
Case"SAVE"
mybll.Insert()
Case"DEL"
mybll.Delete()
EndSelect
myList=mybll.FindByPage()
%>
<h2>客户留言</h2>
<p>
<formname="subForm"id="subForm">
<textareaid="con"name="con"cols="56"rows="6"wrap="VIRTUAL"></textarea>
<inputtype="button"name="submit"value="提交留言"onclick="$('guest/index.asp?tCMD=SAVE&content='+escape(this.form.con.value))"/>
</form>
</p>
<%=myList%>
<%
'///<summary>
'///摘要说明。
'///</summary>
ClassBLL_Guest
'获取信息
PublicSubGetGuest()
PublicSubInsert()
mymod.Content=Request("content")
mymod.re=Request("Re")
mymod.Addtime=Now()
mymod.Ip=request.servervariables("HTTP_X_FORWARDED_FOR")
Iflen(mymod.Ip)<=0Thenmymod.Ip=request.servervariables("REMOTE_ADDR")
PublicSubUpdate()
PublicSubDelete()
PublicFunctionFindByPage()
DimobjRS
Dimtmp1,tmp2,tmp3,parms,i
DimtCMD
tCMD=Request("tCMD")
PageSize="8"
CurrentPage=Request("PageNo")
IfLen(CurrentPage)<=0Then
CurrentPage=1
EndIf
WhereValue=""
OrderValue="Id"
SetobjRS=mydal.FindByPage(PageSize,CurrentPage-1,WhereValue,OrderValue)
i=1
RecordCount=mydal.Count(WhereValue)
DoWhileNotobjRS.EOF
IftCMD="DEL"Then
DEL="<ahref=""?tCMD=DEL&Id="&objRS("Id")&""">删除</a>"
Else
DEL=""
EndIf
parms=Array(i,objRS("content"),objRS("ip"),objRS("addtime"),DEL)
tmp1=tmp1&mycom.Format(LI,parms)
objRs.Movenext
i=i+1
Loop
tmp3=mycom.Page(PageSize,CurrentPage,RecordCount,"guest/index.asp?tCMD=LIST")
parms=Array(tmp1,tmp3)
tmp2=tmp2&mycom.Format(UL,parms)
UL="<UL>{0}<li>{1}</li></UL>"
DEL=""
setmymod=newMOD_Guest
setmydal=newDAL_Guest
Setmymod=Nothing
setmydal=Nothing
%>
<%
'///<summary>
'///摘要说明。
'///</summary>
ClassDAL_Guest
PrivateSQL_01
PrivateSQL_02
PrivateSQL_03
PrivateSQL_04
PrivateSQL_05
asp简单的ajax留言板
80酷酷网 80kuku.com