Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Displaying Pictures


Message #1 by "Drew, Ron" <RDrew@B...> on Wed, 13 Mar 2002 08:07:54 -0500
This is a multi-part message in MIME format.



------_=_NextPart_001_01C1CA90.16817127

Content-Type: text/plain;

	charset="us-ascii"

Content-Transfer-Encoding: quoted-printable



I have a directory with Pictures of events.  The following script works

using FSO, but I would like to change it to use a select with options.

As the number of pictures grow, I do not want the page to scroll.  The

first script currently works. The second shows the select, but I can not

figure out how to make it so the user clicks on one of the items and it

pops the picture up.



Script that works...

<%

   Dim strmonth, stryear, fso, folder, strmy, hit

   strmonth =3D Request.Form("SelMonth")

   stryear =3D Request.Form("SelYear")

   strmy =3D strmonth + stryear

   hit =3D 0

     

   Set fso =3D Server.CreateObject("Scripting.FileSystemObject")

   ' "Events" Folder

   'mPath =3D Server.MapPath("..\member\events")

   Set folder =3D fso.GetFolder(Server.MapPath("..\member\events"))

   If folder.Size > 0 Then

       For Each file in folder.Files

           if Left(file.Name,6) =3D strmy then

              hit =3D hit + 1

           end if

       next

       if hit > 0 then  %>

             <tr>

               <td valign=3D"top"><b>Found <%=3Dhit%> 

Events<br><br></td>

             </tr>

             <tr><td valign=3D"top">

       

             <% For Each file in folder.Files

                    if Left(file.Name,6) =3D strmy then %>

                      <a

href=3D"events/<%=3Dfile.Name%>"><%=3Dfile.Name%></a><br>

             <%     End If

                 Next %>

             </td></tr>

         <% else %>

    <tr>

    <% Response.Write "<B>No Events available for Month " & strmonth & "

in the year " & stryear

         End If

   end if     

   Set folder =3D Nothing

   Set fso =3D nothing

   %>



How do I modify the option on the following to work with a <a href>??

If Left(file.Name,6) =3D strmy  Then %>

 <select NAME=3D"event" SIZE=3D"1">

 <option VALUE=3D"0">Choose a File</option>

 <% For Each file In folder.Files %>

  <option VALUE=3D"<%=3Dfile.Name%>"><% Response.write file.Name & "  (" 

&

file.Size & ")"%></option>

 <%Next

Else

 Response.Write "No event available"

End If




Message #2 by "O'Hara, Elliott M" <EMOHARA@k...> on Wed, 13 Mar 2002 08:11:43 -0500
This message is in MIME format. Since your mail reader does not understand

this format, some or all of this message may not be legible.



------_=_NextPart_001_01C1CA90.9F47425E

Content-Type: text/plain;

	charset="iso-8859-1"



 <select name="event" onchange="window.open('<%=file.Name%>')">

 

should do it



-----Original Message-----

From: Drew, Ron [mailto:RDrew@B...]

Sent: Wednesday, March 13, 2002 8:08 AM

To: ASP Web HowTo

Subject: [asp_web_howto] Displaying Pictures





I have a directory with Pictures of events.  The following script works

using FSO, but I would like to change it to use a select with options.  As

the number of pictures grow, I do not want the page to scroll.  The first

script currently works. The second shows the select, but I can not figure

out how to make it so the user clicks on one of the items and it pops the

picture up.

 

Script that works...

<% 

   Dim strmonth, stryear, fso, folder, strmy, hit

   strmonth = Request.Form("SelMonth")

   stryear = Request.Form("SelYear")

   strmy = strmonth + stryear

   hit = 0

      

   Set fso = Server.CreateObject("Scripting.FileSystemObject")

   ' "Events" Folder

   'mPath = Server.MapPath("..\member\events")

   Set folder = fso.GetFolder(Server.MapPath("..\member\events"))

   If folder.Size > 0 Then

       For Each file in folder.Files

           if Left(file.Name,6) = strmy then

              hit = hit + 1

           end if

       next

       if hit > 0 then  %>

             <tr>

               <td valign="top"><b>Found <%=hit%> Events<br><br></td>

             </tr>

             <tr><td valign="top">

        

             <% For Each file in folder.Files

                    if Left(file.Name,6) = strmy then %>

                      <a href="events/<%=file.Name%>"><%=file.Name%></a><br>

             <%     End If

                 Next %>

             </td></tr>

         <% else %>

    <tr>

    <% Response.Write "<B>No Events available for Month " & strmonth & " in

the year " & stryear

         End If

   end if      

   Set folder = Nothing

   Set fso = nothing

   %>

 

How do I modify the option on the following to work with a <a href>??

If Left(file.Name,6) = strmy  Then %>

 <select NAME="event" SIZE="1">

 <option VALUE="0">Choose a File</option>

 <% For Each file In folder.Files %>

  <option VALUE="<%=file.Name%>"><% Response.write file.Name & "  (" &

file.Size & ")"%></option>

 <%Next

Else

 Response.Write "No event available"

End If




$subst('Email.Unsub'). 






Message #3 by "O'Hara, Elliott M" <EMOHARA@k...> on Wed, 13 Mar 2002 08:12:28 -0500
This message is in MIME format. Since your mail reader does not understand

this format, some or all of this message may not be legible.



------_=_NextPart_001_01C1CA90.BA0DE192

Content-Type: text/plain;

	charset="iso-8859-1"



or a 

 

onchange="location.href=('<%=file.Name%>')"



-----Original Message-----

From: Drew, Ron [mailto:RDrew@B...]

Sent: Wednesday, March 13, 2002 8:08 AM

To: ASP Web HowTo

Subject: [asp_web_howto] Displaying Pictures





I have a directory with Pictures of events.  The following script works

using FSO, but I would like to change it to use a select with options.  As

the number of pictures grow, I do not want the page to scroll.  The first

script currently works. The second shows the select, but I can not figure

out how to make it so the user clicks on one of the items and it pops the

picture up.

 

Script that works...

<% 

   Dim strmonth, stryear, fso, folder, strmy, hit

   strmonth = Request.Form("SelMonth")

   stryear = Request.Form("SelYear")

   strmy = strmonth + stryear

   hit = 0

      

   Set fso = Server.CreateObject("Scripting.FileSystemObject")

   ' "Events" Folder

   'mPath = Server.MapPath("..\member\events")

   Set folder = fso.GetFolder(Server.MapPath("..\member\events"))

   If folder.Size > 0 Then

       For Each file in folder.Files

           if Left(file.Name,6) = strmy then

              hit = hit + 1

           end if

       next

       if hit > 0 then  %>

             <tr>

               <td valign="top"><b>Found <%=hit%> Events<br><br></td>

             </tr>

             <tr><td valign="top">

        

             <% For Each file in folder.Files

                    if Left(file.Name,6) = strmy then %>

                      <a href="events/<%=file.Name%>"><%=file.Name%></a><br>

             <%     End If

                 Next %>

             </td></tr>

         <% else %>

    <tr>

    <% Response.Write "<B>No Events available for Month " & strmonth & " in

the year " & stryear

         End If

   end if      

   Set folder = Nothing

   Set fso = nothing

   %>

 

How do I modify the option on the following to work with a <a href>??

If Left(file.Name,6) = strmy  Then %>

 <select NAME="event" SIZE="1">

 <option VALUE="0">Choose a File</option>

 <% For Each file In folder.Files %>

  <option VALUE="<%=file.Name%>"><% Response.write file.Name & "  (" &

file.Size & ")"%></option>

 <%Next

Else

 Response.Write "No event available"

End If




$subst('Email.Unsub'). 







  Return to Index