<html>
<hea>
<title>Words list</title>
<STYLE TYPE="text/css">
<!-- /* $WEFT -- Created by: Alex (hezhengyu@bit.edu.cn) on 2004-6-14 -- */
@font-face {
font-family: HMPhone BDC;
font-style: normal;
font-weight: normal;
src: url(HMPHONE0.eot);
}
-->
body {
font-family: "Tahoma";
}
</STYLE>
</head>
<body>
<form action="find.asp" id=form1 name=form1>
<input name="name" maxlength="15" size=15>
<input type="submit" value="Find it" name="find">
</form>
<%
sql=""
name=request("name")
sql="select * from words where word like '%"&name&"%'"
set rs=server.createobject("adodb.recordset")
conn = "DBQ="&server.mappath("word.mdb")&";Driver={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;"
rs.open sql,conn,1,1
maxperpage=30
rs.pagesize=maxperpage
if trim(request("page"))<>"" and isnumeric(request("page")) then
currentpage=clng(request("page"))
if currentpage<1 then
currentpage=1
elseif currentpage>rs.pagecount then
currentpage=rs.pagecount
end if
else
currentpage=1
end if
if rs.eof then
response.write "<p align='center'>没有这个单词</p>"
else
totalput=rs.recordcount'记录
if currentpage=1 then
showpages
showcontent
else
if (currentpage-1)*maxperpage<totalput then
rs.move(currentpage-1)*maxperpage
dim bookmark
bookmark=rs.bookmark'移动至开始显示的记录位置
showpages
showcontent
else
currentpage=1
showcontent
end if
end if
rs.close
end if
set rs=nothing
set conn=nothing
sub showcontent
dim i
i=0
do while not (rs.eof or err)
result=replace(rs("word"),name,"<font color=black>"&name&"</font>")
response.write rs("id")&" <font color=red><b>"&result&"</b></font>"&" [<font face=""HMPhone BDC"">"&rs("phonetic")&"</font>] <font color=blue face=""隶书""><b>"&rs("remark")&"</b></font><br>"
i=i+1
if i>=maxperpage then exit do
rs.movenext
loop
end sub
sub showpages()
dim n,k
if(totalput mod maxperpage)=0 then
n=totalput/maxperpage
else
n=int(totalput/maxperpage)+1
end if
%>
Total <%=rs.recordcount%> words.
<%k=currentpage
if k=1 then
response.write "First page Previous "
else
response.write "<b><a href=find.asp?name="&name&"&page=1>First page</a></b> "
response.write "<b><a href=find.asp?name="&name&"&page="&k-1&">Previous</a></b> "
end if
if k=n then
response.write " Next Last page<br>"
else
response.write " <b><a href=find.asp?name="&name&"&page="&k+1&">Next</a></b> "
response.write "<b><a href=find.asp?name="&name&"&page="&n&">Last page</a></b><br>"
end if
end sub%>
</body>
</html>
<hea>
<title>Words list</title>
<STYLE TYPE="text/css">
<!-- /* $WEFT -- Created by: Alex (hezhengyu@bit.edu.cn) on 2004-6-14 -- */
@font-face {
font-family: HMPhone BDC;
font-style: normal;
font-weight: normal;
src: url(HMPHONE0.eot);
}
-->
body {
font-family: "Tahoma";
}
</STYLE>
</head>
<body>
<form action="find.asp" id=form1 name=form1>
<input name="name" maxlength="15" size=15>
<input type="submit" value="Find it" name="find">
</form>
<%
sql=""
name=request("name")
sql="select * from words where word like '%"&name&"%'"
set rs=server.createobject("adodb.recordset")
conn = "DBQ="&server.mappath("word.mdb")&";Driver={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;"
rs.open sql,conn,1,1
maxperpage=30
rs.pagesize=maxperpage
if trim(request("page"))<>"" and isnumeric(request("page")) then
currentpage=clng(request("page"))
if currentpage<1 then
currentpage=1
elseif currentpage>rs.pagecount then
currentpage=rs.pagecount
end if
else
currentpage=1
end if
if rs.eof then
response.write "<p align='center'>没有这个单词</p>"
else
totalput=rs.recordcount'记录
if currentpage=1 then
showpages
showcontent
else
if (currentpage-1)*maxperpage<totalput then
rs.move(currentpage-1)*maxperpage
dim bookmark
bookmark=rs.bookmark'移动至开始显示的记录位置
showpages
showcontent
else
currentpage=1
showcontent
end if
end if
rs.close
end if
set rs=nothing
set conn=nothing
sub showcontent
dim i
i=0
do while not (rs.eof or err)
result=replace(rs("word"),name,"<font color=black>"&name&"</font>")
response.write rs("id")&" <font color=red><b>"&result&"</b></font>"&" [<font face=""HMPhone BDC"">"&rs("phonetic")&"</font>] <font color=blue face=""隶书""><b>"&rs("remark")&"</b></font><br>"
i=i+1
if i>=maxperpage then exit do
rs.movenext
loop
end sub
sub showpages()
dim n,k
if(totalput mod maxperpage)=0 then
n=totalput/maxperpage
else
n=int(totalput/maxperpage)+1
end if
%>
Total <%=rs.recordcount%> words.
<%k=currentpage
if k=1 then
response.write "First page Previous "
else
response.write "<b><a href=find.asp?name="&name&"&page=1>First page</a></b> "
response.write "<b><a href=find.asp?name="&name&"&page="&k-1&">Previous</a></b> "
end if
if k=n then
response.write " Next Last page<br>"
else
response.write " <b><a href=find.asp?name="&name&"&page="&k+1&">Next</a></b> "
response.write "<b><a href=find.asp?name="&name&"&page="&n&">Last page</a></b><br>"
end if
end sub%>
</body>
</html>
演示地址http://www.hzsghj.gov.cn/g7/data/find.asp