Avatar billede alstrup Nybegynder
24. april 2005 - 13:45 Der er 11 kommentarer og
1 løsning

udskiftning af billede på side, uden reload

Jeg har en side med et meget simpelt fotoalbum i asp
på samme side er der også en formular, så man kan bestille billederne online.
Det er meningen at man skal kunne bladre igennem billederne uden at reloade hele siden, så allerede indtastede oplysninger går tabt.
Er det en måde hvorpå man kan udskifte et billede uden at reloade hele siden....
Jeg kan finde ud at det hvis jeg bruger frames, men det er jeg helst fri for... så metoden skal kunne bruges i fx. en tabel hvor billedet bliver udskiftet når man trykker på næste, mens alle indtastede data i formularen ikke slettes....

Venligst Dan
Avatar billede moejensen Nybegynder
24. april 2005 - 13:49 #1
Du skal nok overveje en løsning, hvor du ligger billederne (linksne) i et javascript array, og så skifter det derigennem, så slipper du for at reloade siden.
Avatar billede moejensen Nybegynder
24. april 2005 - 13:50 #2
du kan evt kigge nærmere på det her:

http://www.eksperten.dk/spm/392666
Avatar billede moejensen Nybegynder
24. april 2005 - 13:54 #3
her er et lille eksempel:

<script type="text/javascript">
        var count
        count = 0
        function NextPicture(phaseNr) {
            var Picture= new Array("/images/stue.jpg","/images/stue3.jpg","/images/stue4.jpg","/images/stue2.jpg")           
            document.getElementById('Picture').src = Picture[count]
            count = count + 1;
            if (count > 3)
                count = 0
        }
    </script>


du kalder så funktionen:

<a href="#" onClick="NextPicture();">næste billede</a>

Der hvor billedet skal vises skriver du:

<img src="/images/stue2.jpg" id="picture" width="350" />

Hvis du så gerne vil generere billederne dynamisk, generere du bare arrayet med billedelink på server siden:

var Picture= new Array("/images/stue.jpg","/images/stue3.jpg","/images/stue4.jpg","/images/stue2.jpg")
Avatar billede moejensen Nybegynder
24. april 2005 - 13:58 #4
dynamisk kan du generere strengen, hvis du ex trækker linksne ud af en db:

<%
  strLinkArray = "var Picture= new Array("
  do until rs.eof
    strLinkArray = strLinkArray & "'/images/"& rs("link") &"'"
    rs.movenext
    if not rs.eof then
      strLinkArray = strLinkArray & ","
    End If
  Loop



%>
Avatar billede alstrup Nybegynder
24. april 2005 - 14:20 #5
Albummet kigger i sin egen mappe og ser efter om der er nogle undermapper, og lister billederne fra disse mapper..
man kan så lægge flere billeder og albums op ved at ftp'e en mappe med billeder til mappen på serveren.
Der bliver ikke brugt nogen database, til at gemme informationer i.
Her er lige asp koden jeg har hentet....... Hvis det kan hjælpe..
Jeg kan nemlig ikke lige helt finde ud af hvad jeg skal sætte ind for at den kan vise alle billederne automatisk

----------------
<%@ Language=VBScript %>
<% Option Explicit
Response.Buffer = True
%>
<!-- Begin HTML header -->
<html>
<head>
<title>Photos demo</title>
<meta name="Generator" content="Stone's WebWriter 4">
</head>
<body>
<!-- End HTML Header -->
<%
'#################################################################################
'#
'# USAGE:
'#
'# FREE OF CHARGE!
'#
'# OK, I wrote this from scratch, but I'd be proud if anyone thought it useful
'# enough to use. It is designed so that the relatively untutored can maintain
'# their on-line photo album with nothing more than a basic image editing package,
'# e.g. PaintShop Pro (www.jasc.com) or Microsoft Photo Editor (Part of Office),
'# and an FTP client such as CuteFTP or FTPExplorer. You should be able to avoid
'# ever having to edit the code.
'# All I ask is that: 1. the following lines remain:
%>
<!-- Self administering on-line photo album written in ASP/VBScript by -->
<!-- Stuart Irving - stu.i@btinternet.com -->
<%
'# I would also appreciate a brief email, if you take it live, letting me know
'# the URL.
'#################################################################################
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'
' INSTALLATION:
'
' 1. Create a folder anywhere on the site (eg www.site.com/photos/)
' 2. Insert the necessary HTML headers and footers
' 3. Put this file in the folder created in step 1.
' 4. For each set of pictures to publish create a subfolder
'    (e.g. www.site.com/photos/sept/ and www.site.com/photos/oct/)
' 5. If captions are used, rename the image files so that the filename is
'    the caption (problem: only certain punctuation marks can be used,
'    apostrophes will break it every time
' 6. Load the image files into their respective photos/folders
' 7. Open photos.asp in a browser
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Declaration of variables and constants
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim i                ' Counter
Dim tot                ' Number of piccies
Dim pic                ' Current picture
Dim dir                ' Current folder
Dim MyDirectory        ' Path to folder containing photos.asp
Dim MyFolders        ' List of subfolders (albums)
Dim MyFiles            ' List of files in an album
Dim folderFound        ' individual subfolder
Dim fileFound        ' individual photo
' Turn off captions globally by changing the value of captions to "no"
' Turn off captions individually by naming the file with an initial undescore (_)
Const captions = "yes"
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Store QueryStrings as variables (out of habit)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'Get querystring for pic number as sub-type integer
pic = Cint(Request.QueryString("pic"))
'Get name of folder containing current album
dir = Request.QueryString("dir")
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Create FileSystemObjects
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Set MyDirectory=Server.CreateObject("Scripting.FileSystemObject")
' MyFolders is contents of folder containing photos.asp
Set MyFolders=MyDirectory.GetFolder(Server.MapPath("./"))
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' If there is no current album set it to the first one found
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For Each folderFound In MyFolders.subfolders
    If dir = "" Then
        dir = folderFound.Name
    End If
Next
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Get contents of current album
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Set MyFiles=MyDirectory.GetFolder(Server.MapPath(dir))
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Count the photos
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tot = -1
For Each filefound in MyFiles.files
    tot = tot + 1
Next
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Decide if target photo is outside the range and reset variable pic accordingly
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If pic > tot Then
    pic = 0
ElseIf pic < 0 Then
    pic = tot
End If
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' If there is no current photo set current photo to the first one found
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If Request.QueryString("pic") = "" Then
    pic = 0
End If
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Output some basic page layout - change this to suit the desired appearance
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Response.Write("<table border=0 cellpadding=5 width=500>" & vbCrLf)
Response.Write("<tr><td bgcolor=lightgrey align=center valign=middle height=500>" & vbCrLf)
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Flick through current album until we get to the target photo (pic)
' Output the image path and filename with Server.URLPathEncode so that people who
' insist on clinging to that pathetic software they call Netscape, can see it.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
i = 0
For Each filefound In MyFiles.files
    If pic = i Then
        ' Write out the image tag
        Response.Write ("<img alt='" & filefound.Name & "' src='" & Server.URLPathEncode(dir) & "/" & Server.URLPathEncode(fileFound.Name) & "'><br>" & vbCrLf)
        ' Use File title as caption
        Response.Write("<p>&nbsp;")
        ' Decide if captions are required (globally or individually)
        If captions = "yes" And Left(filefound.Name,1) <> "_" Then
            ' Write out filename as caption, but lop off the letters after the period
            Response.Write(Left(filefound.Name,(Len(filefound.name)-3)))
        End If
        Response.Write("&nbsp;</p>" & vbCrLf)
    End If
    i = i + 1
Next
' Now i is the total number of objects in the folder
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' More layout
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Response.Write("</td></tr>" & vbCrLf)
Response.Write("<tr><td align=center valign=middle>")
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Write out previous and next photo links as text links but images could easily be used
' Be careful with form buttons...! (Netscape again)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Response.Write("<a href='photos.asp?")
Response.Write("dir=" & Server.URLEncode(dir) & "&pic=" & pic-1 & "'><= prev</a>&nbsp;&nbsp;<a href='photos.asp?")
Response.Write("dir=" & Server.URLEncode(dir) & "&pic=" & pic+1 & "'>next =></a><br>" & vbCrLf & vbCrLf)
Response.Write("</td></tr>" & vbCrLf & "<tr><td align=center>")
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Write out menu of available albums as links to the photos in that folder
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Response.Write(" Choose Album: ")
For Each folderFound In MyFolders.SubFolders
    ' Ignore any FrontPage Server Extension folders
    If Left(folderFound.Name,1) <> "_" Then
        Response.Write("<a href=photos.asp?dir=" & Server.URLEncode(folderFound.Name) & ">" & folderFound.Name &"</a>&nbsp;&nbsp;&nbsp;")
    End If
Next
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Finish the layout
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Response.Write(vbCrLf & "</td></tr>" & vbCrLf & "</table>")
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Get rid of the objects
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Set MyDirectory = Nothing
Set MyFiles = Nothing
Set MyFolders = Nothing
%>
<!-- Begin HTML footer -->
</body>
</html>
<!-- End HTML Footer -->

































<table border="0" cellspacing="0" cellpadding="3" style="font-family:'tahoma', 'arial', 'times New Roman';font-size:11;">
<tr>
    <td></td>
    <td></td>
</tr>
<tr>
    <td>Billederne kan bestilles Online her på siden.</td>
    <td></td>
</tr>
<tr>
    <td></td>
    <td></td>
</tr>
<tr>
    <td>&nbsp;</td>
    <td></td>
</tr>
<tr>
    <td>Priser:</td>
    <td></td>
</tr>
<tr>
    <td></td>
    <td></td>
</tr>
<tr style="background-color:#EAEAEA;">
    <td>udprintet på fotopapir</td>
    <td>kr. 8.-</td>
</tr>
<tr>
    <td>Digitalt på email eller CR-Rom</td>
    <td>kr. 5.-</td>
</tr>
<tr style="background-color:#EAEAEA;">
    <td>Ved CD-Rom yderligere pr. CD</td>
    <td>kr. 10.-</td>
</tr>
<tr>
    <td>&nbsp;</td>
    <td></td>
</tr>
<tr>
    <td>Billeder printes på fotopapir i størrelsen 10x15</td>
    <td></td>
</tr>
<tr>
    <td>Digitale billeder ca. 1 Mb pr. stk.</td>
    <td></td>
</tr>
<tr>
    <td>&nbsp;</td>
    <td></td>
</tr><tr>
    <td>&nbsp;</td>
    <td></td>
</tr>
</table>







<table border="0" cellspacing="0" cellpadding="3" style="font-family:'tahoma', 'arial', 'times New Roman';font-size:11;">

</tr><tr>
    <td colspan="2"><hr></td>
    <td></td>
</tr>
</tr><tr>
    <td valign="top" align="center" colspan="2" style="font-weight:bold;">Online Bestilling</td>
    <td></td>
</tr>
</tr><tr>
    <td colspan="2"><hr></td>
    <td></td>
</tr>
<tr>
    <td valign="top" align="right">Dit Navn:</td>
    <td><input type="text" value="" size="100" name="Navn" style="font-family:'tahoma', 'arial', 'times New Roman';font-size:11;width:300px;"></td>
</tr>
<tr>
    <td valign="top" align="right">Din E-mail:</td>
    <td><input type="text" value="" size="100" name="Navn" style="font-family:'tahoma', 'arial', 'times New Roman';font-size:11;width:300px;"></td>
</tr>
<tr>
    <td>&nbsp;</td>
    <td></td>
</tr>
<tr>
    <td colspan="2">Billeder på print og CD-Rom leveres på dit vandglad.dk hold</td>
    <td></td>
</tr>
<tr>
    <td valign="top" align="right">Hold navn<br>og tidspunkt:</td>
    <td><input type="text" value="" size="100" name="Hold" style="font-family:'tahoma', 'arial', 'times New Roman';font-size:11;width:300px;"><br></td>
</tr>
<tr>
    <td valign="top" align="right">Billeder:</td>
    <td><textarea wrap="physical" rows="10" name="Billeder" style="font-family:'tahoma', 'arial', 'times New Roman';font-size:11;width:300px;">Skriv navnet på billeder her, Hvis du bestiller flere billeder så sæt komma imellem</textarea><br></td>
</tr>
<tr>
    <td valign="top" align="right">Type</td>
    <td><select name="type" style="font-family:'tahoma', 'arial', 'times New Roman';font-size:11;width:300px;">
    <option>--  Vælg medie ---</option>
  <option>Print på fotopapir</option>
    <option>Digital på E-mail</option>
  <option>Digital på CD-Rom</option>
</select></td>
</tr>
<tr>
    <td>&nbsp;</td>
    <td></td>
</tr>
<tr>
    <td colspan="2">Nedenstående udfyldes kun ved bestilling af billeder på print.<br>Det angiver hvor mange kopier af hvert bestilt billede der skal udskrives</td>
    <td></td>
</tr>
<tr>
    <td valign="top" align="right">Antal</td>
    <td><input type="text" name="Antal" style="font-family:'tahoma', 'arial', 'times New Roman';font-size:11;width:300px;"></td>
</tr>
<tr>
    <td></td>
    <td></td>
</tr>
<tr>
    <td>&nbsp;</td>
    <td></td>
</tr>
<tr>
    <td align="center" colspan="2"><input type="submit" value="Send Bestilling" style="font-family:'tahoma', 'arial', 'times New Roman';font-size:11;width:100px;"></td>
    <td></td>
</tr>
<tr>
        <td align="center" colspan="2"><input type="reset" value="Nulstil Formular" style="font-family:'tahoma', 'arial', 'times New Roman';font-size:11;width:100px;"></td>
  <td></td>
</tr>
</table>
Avatar billede alstrup Nybegynder
24. april 2005 - 14:24 #6
hovsa, jeg kom til at poste for meget af koden...
Alt det med formularen efter mellemrummet er ikke fædigt..... det er bare formularen jeg var igan med at lave.. da det gik op for mig at den blev slettet hver gang man klikkede på et billede ;-)
Avatar billede moejensen Nybegynder
24. april 2005 - 18:58 #7
så virker dte hos mig:

<%@ Language=VBScript %>
<% Option Explicit
Response.Buffer = True
%>
<!-- Begin HTML header -->
<html>
<head>
<title>Photos demo</title>
<meta name="Generator" content="Stone's WebWriter 4">


</head>
<body>
<!-- End HTML Header -->
<%
'#################################################################################
'#
'# USAGE:
'#
'# FREE OF CHARGE!
'#
'# OK, I wrote this from scratch, but I'd be proud if anyone thought it useful
'# enough to use. It is designed so that the relatively untutored can maintain
'# their on-line photo album with nothing more than a basic image editing package,
'# e.g. PaintShop Pro (www.jasc.com) or Microsoft Photo Editor (Part of Office),
'# and an FTP client such as CuteFTP or FTPExplorer. You should be able to avoid
'# ever having to edit the code.
'# All I ask is that: 1. the following lines remain:
%>
<!-- Self administering on-line photo album written in ASP/VBScript by -->
<!-- Stuart Irving - stu.i@btinternet.com -->
<%
'# I would also appreciate a brief email, if you take it live, letting me know
'# the URL.
'#################################################################################
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'
' INSTALLATION:
'
' 1. Create a folder anywhere on the site (eg www.site.com/photos/)
' 2. Insert the necessary HTML headers and footers
' 3. Put this file in the folder created in step 1.
' 4. For each set of pictures to publish create a subfolder
'    (e.g. www.site.com/photos/sept/ and www.site.com/photos/oct/)
' 5. If captions are used, rename the image files so that the filename is
'    the caption (problem: only certain punctuation marks can be used,
'    apostrophes will break it every time
' 6. Load the image files into their respective photos/folders
' 7. Open photos.asp in a browser
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Declaration of variables and constants
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim i                ' Counter
Dim tot                ' Number of piccies
Dim pic                ' Current picture
Dim dir                ' Current folder
Dim MyDirectory        ' Path to folder containing photos.asp
Dim MyFolders        ' List of subfolders (albums)
Dim MyFiles            ' List of files in an album
Dim folderFound        ' individual subfolder
Dim fileFound        ' individual photo
Dim strLinkArray
Dim fileanddir
' Turn off captions globally by changing the value of captions to "no"
' Turn off captions individually by naming the file with an initial undescore (_)
Const captions = "yes"
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Store QueryStrings as variables (out of habit)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'Get querystring for pic number as sub-type integer
pic = Cint(Request.QueryString("pic"))
'Get name of folder containing current album
dir = Request.QueryString("dir")
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Create FileSystemObjects
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Set MyDirectory=Server.CreateObject("Scripting.FileSystemObject")
' MyFolders is contents of folder containing photos.asp
Set MyFolders=MyDirectory.GetFolder(Server.MapPath("./"))
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' If there is no current album set it to the first one found
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For Each folderFound In MyFolders.subfolders
    If dir = "" Then
        dir = folderFound.Name
    End If
Next
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Get contents of current album
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Set MyFiles=MyDirectory.GetFolder(Server.MapPath(dir))

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Output some basic page layout - change this to suit the desired appearance
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Response.Write("<table border=0 cellpadding=5 width=500>" & vbCrLf)
Response.Write("<tr><td bgcolor=lightgrey align=center valign=middle height=500>" & vbCrLf)
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Flick through current album until we get to the target photo (pic)
' Output the image path and filename with Server.URLPathEncode so that people who
' insist on clinging to that pathetic software they call Netscape, can see it.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
i = 0
For Each filefound In MyFiles.files
    fileanddir = Server.URLPathEncode(dir) & "/" & Server.URLPathEncode(fileFound.Name)
    strLinkArray = strLinkArray & "'" & fileanddir & "'"
    strLinkArray = strLinkArray & ","
    i = i + 1
Next
    strLinkArray = Left(strLinkArray,len(strLinkArray)-1)
    Response.write("<img src=""" & fileanddir & """ id=""picture"" width=""350"" />")

response.write("<script type=""text/javascript"">"& vbCrLf)
response.write("  var count"& vbCrLf)
response.write("  count = 0"& vbCrLf)
response.write("  function NextPicture(phaseNr) {"& vbCrLf)
response.write("      var Picture= new Array("&strLinkArray&")        "& vbCrLf)   
response.write("      document.getElementById('Picture').src = Picture[count]"& vbCrLf)
response.write("      count = count + 1;"& vbCrLf)
response.write("      if (count > "&i-1&")"& vbCrLf)
response.write("          count = 0"& vbCrLf)
response.write("  }"& vbCrLf)
response.write("  function PrevPicture(phaseNr) {"& vbCrLf)
response.write("      var Picture= new Array("&strLinkArray&")        "& vbCrLf)   
response.write("      document.getElementById('Picture').src = Picture[count]"& vbCrLf)
response.write("      count = count - 1;"& vbCrLf)
response.write("      if (count > "&i-1&")"& vbCrLf)
response.write("          count = 0"& vbCrLf)
response.write("      if (count < 0)"& vbCrLf)
response.write("          count = "&i-1&""& vbCrLf)
response.write("  }"& vbCrLf)
response.write("</script>"& vbCrLf)

' Now i is the total number of objects in the folder
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' More layout
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Response.Write("</td></tr>" & vbCrLf)
Response.Write("<tr><td align=center valign=middle>")
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Write out previous and next photo links as text links but images could easily be used
' Be careful with form buttons...! (Netscape again)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Response.Write("<a href=""#"" onClick=""PrevPicture();"">Forrige</a>  " & vbCrLf & vbCrLf)
Response.Write("<a href=""#"" onClick=""NextPicture();"">Næste</a><br>" & vbCrLf & vbCrLf)
Response.Write("</td></tr>" & vbCrLf & "<tr><td align=center>")
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Write out menu of available albums as links to the photos in that folder
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Response.Write(" Choose Album: ")
For Each folderFound In MyFolders.SubFolders
    ' Ignore any FrontPage Server Extension folders
    If Left(folderFound.Name,1) <> "_" Then
        Response.Write("<a href=photos.asp?dir=" & Server.URLEncode(folderFound.Name) & ">" & folderFound.Name &"</a>&nbsp;&nbsp;&nbsp;")
    End If
Next
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Finish the layout
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Response.Write(vbCrLf & "</td></tr>" & vbCrLf & "</table>")
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Get rid of the objects
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Set MyDirectory = Nothing
Set MyFiles = Nothing
Set MyFolders = Nothing
%>
<!-- Begin HTML footer -->
</body>
</html>
<!-- End HTML Footer -->





























<table border="0" cellspacing="0" cellpadding="3" style="font-family:'tahoma', 'arial', 'times New Roman';font-size:11;">
<tr>
    <td></td>
    <td></td>
</tr>
<tr>
    <td>Billederne kan bestilles Online her på siden.</td>
    <td></td>
</tr>
<tr>
    <td></td>
    <td></td>
</tr>
<tr>
    <td>&nbsp;</td>
    <td></td>
</tr>
<tr>
    <td>Priser:</td>
    <td></td>
</tr>
<tr>
    <td></td>
    <td></td>
</tr>
<tr style="background-color:#EAEAEA;">
    <td>udprintet på fotopapir</td>
    <td>kr. 8.-</td>
</tr>
<tr>
    <td>Digitalt på email eller CR-Rom</td>
    <td>kr. 5.-</td>
</tr>
<tr style="background-color:#EAEAEA;">
    <td>Ved CD-Rom yderligere pr. CD</td>
    <td>kr. 10.-</td>
</tr>
<tr>
    <td>&nbsp;</td>
    <td></td>
</tr>
<tr>
    <td>Billeder printes på fotopapir i størrelsen 10x15</td>
    <td></td>
</tr>
<tr>
    <td>Digitale billeder ca. 1 Mb pr. stk.</td>
    <td></td>
</tr>
<tr>
    <td>&nbsp;</td>
    <td></td>
</tr><tr>
    <td>&nbsp;</td>
    <td></td>
</tr>
</table>







<table border="0" cellspacing="0" cellpadding="3" style="font-family:'tahoma', 'arial', 'times New Roman';font-size:11;">

</tr><tr>
    <td colspan="2"><hr></td>
    <td></td>
</tr>
</tr><tr>
    <td valign="top" align="center" colspan="2" style="font-weight:bold;">Online Bestilling</td>
    <td></td>
</tr>
</tr><tr>
    <td colspan="2"><hr></td>
    <td></td>
</tr>
<tr>
    <td valign="top" align="right">Dit Navn:</td>
    <td><input type="text" value="" size="100" name="Navn" style="font-family:'tahoma', 'arial', 'times New Roman';font-size:11;width:300px;"></td>
</tr>
<tr>
    <td valign="top" align="right">Din E-mail:</td>
    <td><input type="text" value="" size="100" name="Navn" style="font-family:'tahoma', 'arial', 'times New Roman';font-size:11;width:300px;"></td>
</tr>
<tr>
    <td>&nbsp;</td>
    <td></td>
</tr>
<tr>
    <td colspan="2">Billeder på print og CD-Rom leveres på dit vandglad.dk hold</td>
    <td></td>
</tr>
<tr>
    <td valign="top" align="right">Hold navn<br>og tidspunkt:</td>
    <td><input type="text" value="" size="100" name="Hold" style="font-family:'tahoma', 'arial', 'times New Roman';font-size:11;width:300px;"><br></td>
</tr>
<tr>
    <td valign="top" align="right">Billeder:</td>
    <td><textarea wrap="physical" rows="10" name="Billeder" style="font-family:'tahoma', 'arial', 'times New Roman';font-size:11;width:300px;">Skriv navnet på billeder her, Hvis du bestiller flere billeder så sæt komma imellem</textarea><br></td>
</tr>
<tr>
    <td valign="top" align="right">Type</td>
    <td><select name="type" style="font-family:'tahoma', 'arial', 'times New Roman';font-size:11;width:300px;">
    <option>--  Vælg medie ---</option>
  <option>Print på fotopapir</option>
    <option>Digital på E-mail</option>
  <option>Digital på CD-Rom</option>
</select></td>
</tr>
<tr>
    <td>&nbsp;</td>
    <td></td>
</tr>
<tr>
    <td colspan="2">Nedenstående udfyldes kun ved bestilling af billeder på print.<br>Det angiver hvor mange kopier af hvert bestilt billede der skal udskrives</td>
    <td></td>
</tr>
<tr>
    <td valign="top" align="right">Antal</td>
    <td><input type="text" name="Antal" style="font-family:'tahoma', 'arial', 'times New Roman';font-size:11;width:300px;"></td>
</tr>
<tr>
    <td></td>
    <td></td>
</tr>
<tr>
    <td>&nbsp;</td>
    <td></td>
</tr>
<tr>
    <td align="center" colspan="2"><input type="submit" value="Send Bestilling" style="font-family:'tahoma', 'arial', 'times New Roman';font-size:11;width:100px;"></td>
    <td></td>
</tr>
<tr>
        <td align="center" colspan="2"><input type="reset" value="Nulstil Formular" style="font-family:'tahoma', 'arial', 'times New Roman';font-size:11;width:100px;"></td>
  <td></td>
</tr>
</table>
Avatar billede alstrup Nybegynder
24. april 2005 - 19:20 #8
Det virker også hos mig... eller næsten.
Hvis man skifter mappe bliver formularen nulstillet
Men hvis man bliver i samme mappe nulstilles sen ikke.
Kan det lade sig gøre at skifte mappe uden at formularen nulstilles.?
Avatar billede alstrup Nybegynder
24. april 2005 - 19:23 #9
Og filnavnet mangler så man ikke kan se hvad billedet hedder ved bestilling
Og billederne bliver vist forstørret
Avatar billede moejensen Nybegynder
24. april 2005 - 19:45 #10
Hvis du skal lave det så siden heller ikke skifter hvis du skifter mappe, så skal du lægge alle linksne over i javascript, og så er de rikke rigtig noget tilbage af det du startede med.

de andre spg retter du ved at rette denne linie:

Response.write("<img src=""" & fileanddir & """ id=""picture"" width=""350"" />")

til

Response.write("<img src=""" & fileanddir & """ id=""picture"" alt="""&fileanddir &""" />")
Avatar billede alstrup Nybegynder
24. april 2005 - 19:52 #11
Ok, mange tak for hjælpen,
Det har virkelig været super lærerigt for mig.

Jeg vil forsøge og se hvad jeg kan komme videre med.

Igen mange tak.
Avatar billede moejensen Nybegynder
24. april 2005 - 19:55 #12
Det var så lidt ;-)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester