Ask a Question related to ASP Database, Design and Development.
-
A. J. #1
Display images name thrue drop down box
Hi,
I have a folder include images and i want to disply the names of these
images in drop down box and when i change the name the image also
change.
I wrote these code to to that
=========
<html>
<head>
<script language="javascript">
<!--
function showimage()
{
if (!document.images)
return
document.images.pictures.src=
document.mygallery.picture.options[document.mygallery.picture.selectedIn
dex].value
}
//-->
</script>
</head>
<body>
<%
' Create an instance of the FileSystemObject
Set MyFileObject=Server.CreateObject("Scripting.FileSy stemObject")
' Create Folder Object
Set
MyFolder=MyFileObject.GetFolder(Server.MapPath("/zad-alrida/images/produ
cts/"))
response.write(MyFolder)
'Loop trough the files in the folder
FOR EACH thing in MyFolder.Files
%>
<form name="mygallery"><p><select name="picture" size="1"
onChange="showimage()">
<option selected value="<%=thing.Name%>"><%=thing.Name%></option>
</select>
<img src="<%=thing.Name%>" name="pictures" width="99" height="100">
<% next %>
</form>
</body>
</html>
=========
but everytime I run this script all images are dsiplay at the same time
:(
do you have any solution ???
Thanks in advance
A. J.
A. J.
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
A. J. Guest
-
Images blocking the Drop down Menu
Hi, I created a drop down menu. But blocked with images below. What can I do? Please help, Thanks! Mikeco -
implementation of Affiliates program thrue linkshare
Hi, Has anybody implemented an Affiliates program from some comapny as i have to implement the same in my company. LinkShare functions as an... -
Images in a drop down
Can images be rendered in a drop down object. I create subscripts and superscripts as images in fireworks and then place the path of the image in a... -
drop down list always a vertical display
Okay. I followed the steps from a MS KB article (306227, i think) about how to create a frop down box in a data grid, and bind to data. However,... -
Drop shadow and display performance
Has anyone else noticed that applying drop shadow affects the display performance of the spread you're working on - making the type etc look bitty or... -
Boris Nikolaevich #2
Re: Display images name thrue drop down box
To help you think through the process, indent each line of code or HTML
according to what's happening. (You don't have to save your code with the
indentations if you don't want to, but it will help.
Here's an example of what I mean:
<snip>
...
'Loop trough the files in the folder
FOR EACH thing in MyFolder.Files
%>
<form name="mygallery"><p>
<select name="picture" size="1" onChange="showimage()">
<option selected
value="<%=thing.Name%>"><%=thing.Name%></option>
</select>
<img src="<%=thing.Name%>" name="pictures" width="99" height="100">
<% next %>
</form>
...
</snip>
Do you see how things don't quite match up? For example, the opening <form>
tag occurs inside your For/Next loop, but the closing tag occurs outside the
loop. Your <select> tag and <img> tag also are inside the loop. That means
as the code runs, you will get many forms (which won't work), many drop-down
lists with only one item, and many images--one for EACH file in your folder.
Now think about what you WANT to happen. You want one form, and one image,
but multiple options in your drop-down list. Without showing you the code
(the poeple in the groups made me learn on my own, too), you need to change
your loop so that only the <option> tags are repeated--one element for each
file in your folder.
One last note is that if you want the <img> to show the first picture by
default, you'll either need to use client script or add a variable to your
ASP that stores the name of the first file (e.g. replaces
src="<%=thing.Name%>" with src="<%=strFirstPictureName%>"
Hope that gets you started,
Boris
"A. J." <a_jifri@hotmail.com> wrote in message
news:%23qBUYGvcDHA.1580@tk2msftngp13.phx.gbl...> Hi,
> I have a folder include images and i want to disply the names of these
> images in drop down box and when i change the name the image also
> change.
> I wrote these code to to that
> =========
> <html>
> <head>
> <script language="javascript">
> <!--
> function showimage()
> {
> if (!document.images)
> return
> document.images.pictures.src=
> document.mygallery.picture.options[document.mygallery.picture.selectedIn
> dex].value
> }
> //-->
> </script>
> </head>
>
> <body>
> <%
> ' Create an instance of the FileSystemObject
> Set MyFileObject=Server.CreateObject("Scripting.FileSy stemObject")
> ' Create Folder Object
> Set
> MyFolder=MyFileObject.GetFolder(Server.MapPath("/zad-alrida/images/produ
> cts/"))
> response.write(MyFolder)
> 'Loop trough the files in the folder
> FOR EACH thing in MyFolder.Files
> %>
>
> <form name="mygallery"><p><select name="picture" size="1"
> onChange="showimage()">
>
> <option selected value="<%=thing.Name%>"><%=thing.Name%></option>
> </select>
> <img src="<%=thing.Name%>" name="pictures" width="99" height="100">
> <% next %>
> </form>
> </body>
> </html>
> =========
> but everytime I run this script all images are dsiplay at the same time
> :(
> do you have any solution ???
>
> Thanks in advance
> A. J.
>
> A. J.
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!
Boris Nikolaevich Guest
-
A. J. #3
Re: Display images name thrue drop down box
You know, when i use your modify the images still disply many times, but
I need it to be one image and one drop down box which include images
name ...
Please I really need your advice
A. J.
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
A. J. Guest
-
Boris Nikolaevich #4
Re: Display images name thrue drop down box
My modification of your code was NOT a suggestion on how to write the
function correctly, it was a suggestion on how to identify the error. Doing
that will be way more help than having someone post the correct code for
you.
Have you been able to get your script to work correctly? If you are still
having the same problem, I can post some additional advice.
"A. J." <a_jifri@hotmail.com> wrote in message
news:uXqKHjAdDHA.560@TK2MSFTNGP11.phx.gbl...> You know, when i use your modify the images still disply many times, but
> I need it to be one image and one drop down box which include images
> name ...
> Please I really need your advice
>
> A. J.
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!
Boris Nikolaevich Guest
-
A. J. #5
Re: Display images name thrue drop down box
Thanks a lot Mr Boris, it's working great now
A. J.
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
A. J. Guest



Reply With Quote

