Hvis du vil have en hel færdig side:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd"><%
Dim CurFile, PopFileShowSub, ShowPic, PictureNo
Dim strPathInfo, strPhysicalPath
Dim intTotPics, intPicsPerRow, intPicsPerPage, intTotPages, intPage, strPicArray()
intPicsPerRow = 1
intPicsPerPage = 6
intPage = CInt(Request.QueryString("Page"))
If intPage = 0 Then
intPage = 1
End If
CurFile = "default.asp"
PopFile = "showpicture.asp"
%>
<html>
<head>
<title>Fotoalbum</title>
<META HTTP-EQUIV="Expires" CONTENT="Fri, Jun 12 1981 08:20:00 GMT">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-store">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="content-type" content="text/html;charset=iso-8859-1">
<META HTTP-EQUIV="imagetoolbar" content="no">
<META HTTP-EQUIV="Content-language" content="dan">
<META NAME="robots" content="all">
<link rel="stylesheet" type="text/css" href="/includes/style.css">
<script language="JavaScript">
<!--
function jumppage(sel)
{
var i = sel.selectedIndex
self.location.href = sel.options[i].value
}
// -->
</script>
<script language="JavaScript">
<!-- hide from JavaScript-challenged browsers
function openGalleryWindow(url) {
if (document.all)
var xMax = screen.width, yMax = screen.height;
else
if (document.layers)
var xMax = window.outerWidth, yMax = window.outerHeight;
else
var xMax = 800, yMax=600;
var xOffset = (xMax - 200)/2, yOffset = (yMax - 200)/2;
var xOffset = 100, yOffset = 100;
popupWin = window.open(url,'new_page','width=700,height=535,screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+',scrollbars=auto,toolbars=no,menubar=no,resizable=yes')
}
// done hiding -->
</script>
</head>
<body>
<div align="center">
<table cellpadding="0" cellspacing="0" style="width: 755px;" class="text11">
<tr>
<td colspan="2" style="width: 755px; height: 80px;"><span class="h22">Billeder</span></td>
</tr>
<tr>
<td style="width: 160px; padding: 8px 8px 0px 8px;" align="left" valign="top"><b>Menu</b></td>
<td style="width: 595px;" align="left" valign="top">
<div align="center">
<form action=<%=PopFile%> method="POST">
<table cellpadding="0" cellspacing="0" style=" border: 0px; width: 100%;" id="AutoNumber1" class="text11">
<tr>
<td align="left">
<b>Vælg fotoalbum:</b>
<select name="go" onChange="jumppage(this);" size=1 class="input1">
<%
ShowSub = request("ShowSub")
ShowPic = request("ShowPic")
strPathInfo = Request.ServerVariables("PATH_INFO")
strPhysicalPath = Server.MapPath(strPathInfo)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(strPhysicalPath)
Set objFolder = objFile.ParentFolder
Set objFolderContents = objFolder.Files
For each Folder in objFolder.SubFolders
If Left(Folder.Name,1)<>"_" Then
Response.write "<option "
If ShowSub=Folder.Name Then
Response.Write "selected "
End if
Response.Write"value='" & CurFile & "?ShowSub="
Response.Write(Replace(Folder.Name, " ", "%20"))
Response.Write "'>"
Response.Write(Folder.Name & "</option>")
If ShowSub <= " " Then
ShowSub = Folder.Name
End if
End if
Next
Set objFSO = Nothing
%>
</select>
</td>
</tr>
</table>
</form>
<%
If ShowPic > " " Then
ShowPic = Replace(ShowPic, " ", "%20")
%>
<a href="java script:history.go(-1)"><img src="<%=ShowPic%>" alt=""><br><br><b>Tilbage</b></a>
<% Else %>
<table cellspacing="4" style="width: 100%;" id="AutoNumber1" class="text11">
<tr>
<%
strPhysicalPath = Server.MapPath(".\" & ShowSub)
If ShowSub > " " then
ShowSub = Replace(ShowSub, " ", "%20")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strPhysicalPath)
Set objFolderContents = objFolder.Files
'Get the number of pictures in the subdirectory
intTotPics = 0
For Each objFileItem in objFolderContents
If Ucase(Right(objFileItem.Name,4))=".GIF" OR Ucase(Right(objFileItem.Name,4))=".JPG" THEN
intTotPics = intTotPics + 1
End If
Next
'Get the total number of pages in the subdirectory
If (intTotPics/intPicsPerPage) = (int(intTotPics/intPicsPerPage)) Then
intTotPages = int(intTotPics/intPicsPerPage)
Else
intTotPages = int(intTotPics/intPicsPerPage)+1
End If
Redim strPicArray(2,intTotPics) 'Store picture file names in an array
x = 0
For Each objFileItem in objFolderContents
If Ucase(Right(objFileItem.Name,4))=".GIF" OR Ucase(Right(objFileItem.Name,4))=".JPG" THEN
strPicArray(0,x) = objFileItem.Name
strPicArray(1,x) = Cstr(int(x/intPicsPerPage)+1)
x = x + 1
End If
Next
If intTotPages > 1 Then
Response.Write "<td colspan='" & intPicsPerRow & "' valign='top' align='left'>Side: "
For x = 1 to intTotPages
If x = intPage Then
Response.Write "<b>" & x & "</b> "
Else
Response.Write "<a href='default.asp?Page=" & x & "&ShowSub=" & ShowSub & "'>" & x & "</a> "
End If
Next
%></td>
</tr>
<tr>
<%
End If
Dim bgcolor
bgcolor = "#ececd9;"
For x = 0 to UBound(strPicArray,2)-1
If CInt(strPicArray(1,x)) = intPage Then
ShowPic = Replace(strPicArray(0,x), " ", "%20")
If bgcolor="#ececd9" Then
bgcolor = "#e7e7e7"
Else
bgcolor = "#ececd9"
End if
%>
<td valign="top" align="left" style="background-color: <%=bgcolor%>; width: 75%;">
<b>Det er ikke muligt at vedhæfte billedtekst i øjeblikket</b><br>
Navn på fil angiver dato
</td>
<td align="center" valign="top" style="width: 25%; background-color: <%=bgcolor%>;">
<%
Response.write "<a href=""java script:openGalleryWindow('" & PopFile & "?ShowPic=" & ShowSub & "/" & ShowPic & "')"""
Response.write "<br>"
Response.Write("<img src='" & ShowSub & "/" & strPicArray(0,x) & "' width=150> ")
Response.Write("<br><b>" & Mid(strPicArray(0,x),1,Len(strPicArray(0,x))-4) & "</b>")
Response.write "</a></td>" & vbcrlf
PictureNo = PictureNo + 1
If PictureNo=intPicsPerRow Then
%>
</tr>
<tr>
<%
PictureNo = 0
End if
End If
Next
Set objFSO = Nothing
End If
%>
</tr>
</table>
<% End If %>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>