📄 default.asp
字号:
<%@ language = "VBSCRIPT" %>
<!--#include file="globvars.asp"-->
<!--#include file="imgsz.asp"-->
<!--#include file="commfunc.asp"-->
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage 2.0">
<title>Image Gallery</title>
<%
Public PageNumb, QuerStri, SearStri, EncoStri
SearStri = request.querystring("ss")
if SearStri = "ALL IMAGES" OR SearStri = "" then
SearStri = "ALL IMAGES"
QuerStri = "SELECT AutoNumb, ImagName, ThumName " & _
"FROM gallery ORDER BY AutoNumb DESC"
else
QuerStri = "SELECT AutoNumb, ImagName, ThumName " & _
"FROM gallery " & _
"WHERE " & _
"ImagDesc LIKE '%" & SearStri & "%' " & _
"ORDER BY AutoNumb DESC"
end if
EncoStri = Server.URLEncode(SearStri)
PageNumb = request.querystring("pn") 'The Page Number To Display
if PageNumb="" then
PageNumb=1
else
PageNumb=cint(PageNumb)
end if
Public Function imag_html(ByRef nr, ByVal an, ByVal inm, ByVal tnm)
' Input: nr = num images in current row thus far
' an = AutoNumb for image record
' inm = image path, name
' tnm = thumbnail path, name
' Output: return html for image
Dim s, w, h, d, t
s = ""
if nr = NumbImagRow_ then
s = "<br><br>"
nr = 0
end if
if EnabThumNail AND IsNull(tnm) then
if NOT gfxSpex(Server.MapPath(inm),w,h,d,t) then
s = "Image Not Found"
else
w = CInt((ThumPercSize * w) / 100)
h = CInt((ThumPercSize * h) / 100)
s = s & "<a href='dispimag.asp?an=" & an & "&di=none&pn=" & PageNumb
s = s & "&ss=" & EncoStri & "'>"
s = s & "<img src='" & inm & "' border='" & ImagBordThic & "' width='"
s = s & w & "' height='" & h & "'></a>"
end if
elseif EnabThumNail then '' tnm = file path name
if NOT gfxSpex(Server.MapPath(tnm),w,h,d,t) then
s = "Image Not Found"
else
s = s & "<a href='dispimag.asp?an=" & an & "&di=none&pn=" & PageNumb
s = s & "&ss=" & EncoStri & "'>"
s = s & "<img src='" & tnm & "' border='" & ImagBordThic & "' width='"
s = s & w & "' height='" & h & "'></a>"
end if
else
if NOT gfxSpex(Server.MapPath(inm),w,h,d,t) then
s = "Image Not Found"
else
s = s & "<img src='" & inm & "' border='" & ImagBordThic & "' width='"
s = s & w & "' height='" & h & "'>"
end if
end if
h = 0
do while h <> NumbSpacBetw
s = s & " "
h = h + 1
loop
nr = nr + 1
imag_html = s
End Function
Public Function page_menu(ByVal cp, ByVal np)
' Input: cn = connection object
' cp = current page
' np = num pages
' Output: s = "Previous Page - 1 - 2 ... Next Page"
Dim s, n, p
s = "<font color='#0000FF' size='2'>"
if cp > 1 then
n = cp - 1
s = s & "<a href='default.asp?pn=" & n & "&ss=" & EncoStri & "'>Previous Page</a>"
else
s = s & "Previous Page"
end if
p = 0 ' P0 == p = number pages added to string thus far
n = cp - 5
do while n <> np + 1 AND p <> 9
if 1 <= n then
s = s & " - "
if n=cp then
s = s & "<a href='default.asp?pn=" & n & "&ss=" & EncoStri & "'><strong>" & _
CStr(n) & "</strong></a>"
else
s = s & "<a href='default.asp?pn=" & n & "&ss=" & EncoStri & "'>" & CStr(n) & "</a>"
end if
p = p + 1
end if
n = n + 1
loop ' n=np+1 v p=9
if n = np+1 then
s = s & " - "
else
s = s & " ... "
end if
if cp < np then
n = cp + 1
s = s & "<a href='default.asp?pn=" & n & "&ss=" & EncoStri & "'>Next Page</a>"
else
s = s & "Next Page"
end if
s = s & "</font></strong>"
page_menu = s
End Function
%>
</head>
<body bgcolor="#FFFFFF">
<div align="center"><center>
<table border="0" cellpadding="2" cellspacing="0" width="96%">
<tr>
<td align="center" width="100%" bgcolor="#FFFFB0"><font
color="#FF0000" size="3" face="Verdana"><strong>ASP-Gallery
Demo/Title Cell</strong></font></td>
</tr>
</table>
</center></div><div align="center"><center>
<table border="0" cellpadding="7" cellspacing="0" width="96%">
<tr>
<td valign="top" width="18%" bgcolor="#C0C0C0"><p
align="left"><font color="#000000" size="1"
face="Verdana"><strong>This is exactly how your gallery
will look to begin with!</strong></font></p>
<p align="left"><font color="#000000" size="1"
face="Verdana"><strong>Search finds matches in
description and title in all images. For this demo search
with "on" or "view" for multiple
hits.</strong></font></p>
<p align="left"><font color="#000000" size="1"
face="Verdana"><strong>Remember, if you want some custom
work done for your gallery or other asp pages, please </strong></font><a
href="mailto:gmarston@unicormed.com"><font
color="#0000FF" size="1" face="Verdana"><strong>email</strong></font></a><font
color="#000000" size="1" face="Verdana"><strong> me.</strong></font></p>
<p align="left"><a href="../default.asp"><font
color="#0000FF" size="1" face="Verdana"><strong>Home</strong></font></a></p>
<p align="left"><font color="#000000" size="1"
face="Verdana"><strong>Many of these images are courtesy
of </strong></font><a href="http://www.freefoto.com/"><font
color="#000000" size="1" face="Verdana"><strong>FreeFoto.com</strong></font></a><font
color="#000000" size="1" face="Verdana"><strong>.</strong></font></p>
</td>
<td valign="top" width="82%"><%
Dim Conn, n, Rec, Str, NumRow
if EnabSearFeat <> 0 then
Str = "<form action='submsear.asp' "
Str = Str & "method='POST' name='Search'>"
Str = Str & "<p align='right'><a "
Str = Str & "href='default.asp?ss=ALL+IMAGES'><font "
Str = Str & "color='#0000FF' size='1' face='Verdana'><strong>Show "
Str = Str & "All Images</strong></font></a><font color='#0000FF' "
Str = Str & "size='1' face='Verdana'><strong> </strong></font><input "
Str = Str & "type='submit' name='submit' value='Search'>: <input "
Str = Str & "type='text' size='20' name='SearText' "
Str = Str & "value='" & SearStri & "'></p>"
Str = Str & "<hr size='1'>"
Str = Str & "</form>"
response.write Str
end if
response.write "<p align='center'>"
Call open_data(Conn, DataPathName)
Set Rec = Server.CreateObject("ADODB.Recordset")
Rec.Open QuerStri, Conn, 3
if not Rec.EOF then
Rec.PageSize = NumbImagPage
LastPage = Rec.PageCount
Rec.AbsolutePage = PageNumb
Str = page_menu(PageNumb, LastPage) & "<br><br>"
response.write Str
NumRow = 0 '' NumRow = # images in current row thus far
n = 0
do while n <> Rec.PageSize AND not Rec.EOF
Str = imag_html(NumRow, Rec("AutoNumb"), Rec("ImagName"), Rec("ThumName"))
Response.Write(Str)
Rec.MoveNext
n = n + 1
loop
response.write "<br><br>"
Str = page_menu(PageNumb, LastPage)
response.write Str
else
response.write "No records were found using the above search!"
end if
Rec.close
set Rec = nothing
Conn.close
set Conn = nothing
%> <p align="right"><font
color="#000000" size="2" face="Times New Roman"><tt>Developed
by </tt></font><a
href="http://www.bjtester.com/gmarston/"><font
color="#0000FF" size="2" face="Times New Roman"><tt>Greg
Marston</tt></font></a></p>
</td>
</tr>
</table>
</center></div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -