ASP留言代码.docx
《ASP留言代码.docx》由会员分享,可在线阅读,更多相关《ASP留言代码.docx(14页珍藏版)》请在冰点文库上搜索。
ASP留言代码
ASP留言代码(留言网页界面制作)
ASP留言代码1
1.制作留言界面book.asp1
2.制作连接数据库的中介conn.asp界面9
3.新建一个数据库9
ASP留言代码
1.制作留言界面book.asp
代码如下
--#includefile="conn.asp"-->
DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http:
//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
//www.w3.org/1999/xhtml">
ASP留言代码
--
body{
margin-left:
0px;
margin-top:
0px;
margin-right:
0px;
margin-bottom:
0px;
}
a:
link{
text-decoration:
none;
}
a:
visited{
text-decoration:
none;
}
a:
hover{
text-decoration:
none;
}
a:
active{
text-decoration:
none;
}
body,td,th{
font-size:
12px;
}
-->
--
functionMM_preloadImages(){//v3.0
vard=document;if(d.images){if(!
d.MM_p)d.MM_p=newArray();
vari,j=d.MM_p.length,a=MM_preloadImages.arguments;for(i=0;iif(a[i].indexOf("#")!
=0){d.MM_p[j]=newImage;d.MM_p[j++].src=a[i];}}
}
//-->
|
<%dimrndnum,verifycode Randomize DoWhileLen(rndnum)<4 num1=CStr(Chr((57-48)*rnd+48)) rndnum=rndnum&num1 loop session("verifycode")=rndnum %> <% ifRequest("work")="add"then verifycode=trim(Request.Form("verifycode")) verifycode2=trim(Request.Form("verifycode2")) ifverifycode<>verifycode2then Response.Write"" Response.Write"alert('验证码错误! ');" Response.Write"history.go(-1);" Response.Write"" else session("verifycode")="" setrs=server.createobject("adodb.recordset") sql="select*fromliuyan" rs.opensql,conn,3,3 rs.addnew rs("B_name")=Request("B_name") rs("B_msn")=Request("B_msn") rs("B_mail")=Request("B_mail") rs("B_tel")=Request("B_tel") rs("B_dom")=Request("B_dom") rs.update'更新数据表记录 Response.Redirect"book.asp" EndIF Endif %>
|
|
姓名:
color="#ff6600">*
留言信息:
|
| |
QQ:
color="#ff6600">*
|
E-mail:
color="#ff6600">*
|
电话:
color="#ff6600">*
|
验证码:
1441
|
|
搜索:
|
|
|
[===信息列表===] | |
<%
shou=Request("shou")
ifshou=""then
sql="select*fromliuyanorderbyidDESC"
else
sql="select*fromliuyanwhereB_namelike'%"&shou&"%'orB_domlike'%"&shou&"%'orderbyidDESC"
endif
setrs=server.createobject("adodb.recordset")
rs.opensql,conn,1,1
IFNotrs.eofThen
proCount=rs.recordcount
rs.PageSize=3'定义显示数目
ifnotIsEmpty(Request("ToPage"))then
ToPage=CInt(Request("ToPage"))
ifToPage>rs.PageCountthen
rs.AbsolutePage=rs.PageCount
intCurPage=rs.PageCount
elseifToPage<=0then
rs.AbsolutePage=1
intCurPage=1
else
rs.AbsolutePage=ToPage
intCurPage=ToPage
endif
else
rs.AbsolutePage=1
intCurPage=1
endif
intCurPage=CInt(intCurPage)
Fori=1tors.PageSize
ifrs.EOFthen
ExitFor
endif
%>
<%=rs("B_name")%>在(<%=rs("B_date")%>)
|
| <%=rs("B_dom")%>
<%iftrim(rs("B_hui"))<>""then%>
管理员回复
:
<%=rs("B_hui")%>
<%endif%>
|
<%
rs.MoveNext
next
%>
| 9pt;">共: <%=rs.PageCount%>页,<%=proCount%>信息,第<%=intCurPage%>页 <%ifintCurPage<>1then %> |上一页| <%endif ifintCurPage<>rs.PageCountthen%> 下一页|尾页| <%endif%> | <% else %>
尚无任何留言! [===<%=Request("shou")%>===] | <% endif rs.close setrs=nothing %> |
functioncheck()
{
if(document.Form1.B_name.value=="")
{
alert("Inputyourname!
")
document.Form1.B_name.focus()
document.Form1.B_name.select()
return
}
if(document.Form1.B_msn.value=="")
{
alert("InputyourMSN!
")
document.Form1.B_msn.focus()
document.Form1.B_msn.select()
return
}
if(document.Form1.B_mail.value=="")
{
alert("InputyourEmail!
")
document.Form1.B_mail.focus()
document.Form1.B_mail.select()
return
}
if(document.Form1.B_tel.value=="")
{
alert("InputyourTel!
")
document.Form1.B_tel.focus()
document.Form1.B_tel.select()
return
}
if(document.Form1.B_dom.value=="")
{
alert("Inputyourmessage!
")
document.Form1.B_dom.focus()
document.Form1.B_dom.select()
return
}
document.Form1.submit()
}