473,763 Members | 10,250 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamic slideshow

pradeepjain
563 Contributor
script>
Expand|Select|Wrap|Line Numbers
  1. // (C) 2000 www.CodeLifter.com
  2. // http://www.codelifter.com
  3. // Free for all users, but leave in this  header
  4. // NS4-6,IE4-6
  5. // Fade effect only in IE; degrades gracefully
  6.  
  7. // =======================================
  8. // set the following variables
  9. // =======================================
  10.  
  11. // Set slideShowSpeed (milliseconds)
  12. var slideShowSpeed = 5000
  13.  
  14. // Duration of crossfade (seconds)
  15. var crossFadeDuration = 3
  16.  
  17. // Specify the image files
  18. var Pic = new Array() // don't touch this
  19. // to add more images, just continue
  20. // the pattern, adding to the array below
  21.  
  22. Pic[0] = '1.jpg'
  23. Pic[1] = '2.jpg'
  24. Pic[2] = '3.jpg'
  25. Pic[3] = '4.jpg'
  26. Pic[4] = '5.jpg'
  27.  
  28. // =======================================
  29. // do not edit anything below this line
  30. // =======================================
  31.  
  32. var t
  33. var j = 0
  34. var p = Pic.length
  35.  
  36. var preLoad = new Array()
  37. for (i = 0; i < p; i++){
  38.    preLoad[i] = new Image()
  39.    preLoad[i].src = Pic[i]
  40. }
  41.  
  42. function runSlideShow(){
  43.    if (document.all){
  44.       document.images.SlideShow.style.filter="blendTrans(duration=2)"
  45.       document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
  46.       document.images.SlideShow.filters.blendTrans.Apply()      
  47.    }
  48.    document.images.SlideShow.src = preLoad[j].src
  49.    if (document.all){
  50.       document.images.SlideShow.filters.blendTrans.Play()
  51.    }
  52.    j = j + 1
  53.    if (j > (p-1)) j=0
  54.    t = setTimeout('runSlideShow()', slideShowSpeed)
  55. }
  56. </script>
  57.  


i am using this javascript code for slideshow of images...i am in a small problem.....wht my client requires is tht when ever he puts a image in a particular folder tht image must be involved in the slideshow with out specifying the name of the image in code....is there any way so as to make javascript to pick all images in a folder and create a slideshow
Dec 10 '07 #1
2 3143
Dasty
101 Recognized Expert New Member
Your javascript code runs on client computer. So it does not have direct access to get webserver directory structure - content (and it is anyway forbidden on 99% of web servers anyway - i mean browse rights). You have to use server's code (php / aspx) to get all images in web's directory and sent the result to client.
Dec 10 '07 #2
Sonasang
27 New Member
Your javascript code runs on client computer. So it does not have direct access to get webserver directory structure - content (and it is anyway forbidden on 99% of web servers anyway - i mean browse rights). You have to use server's code (php / aspx) to get all images in web's directory and sent the result to client.

It's a good solution, but he did say he wanted previous/next buttons.

this should work, though, i did not test it.


Expand|Select|Wrap|Line Numbers
  1. <%
  2. '//----------------------------------------------------
  3. '// declare some constants and variables
  4. '//----------------------------------------------------
  5. dim oFileSystem, oFolder, nFile, i, aFilenames, lookUp
  6.  
  7. i = 0
  8. const IMAGE_DIRECTORY = "/path_to_my_image_directory/"
  9.  
  10. '//----------------------------------------------------
  11. '// set up FSO
  12. '//----------------------------------------------------
  13. set oFileSystem = server.createobject("scripting.filesystemobject")
  14.  
  15. '//----------------------------------------------------
  16. '// get all images in image directory, store filenames
  17. '// in array
  18. '//----------------------------------------------------
  19. set oFolder = oFileSystem.getFolder(server.mappath(IMAGE_DIRECTO  RY))
  20.  
  21. '//----------------------------------------------------
  22. '// resize array to fit number of files in directory
  23. '//----------------------------------------------------
  24. redim aFilenames(oFolder.files.count - 1)
  25.  
  26. '//----------------------------------------------------
  27. '// loop through files in folder, assign each to
  28. '// index in array
  29. '//----------------------------------------------------
  30. for each nFile in oFolder.files
  31.    aFilenames(i) = nFile.name
  32.    i = i + 1
  33. next
  34.  
  35. set oFolder = nothing
  36. set oFileSystem = nothing
  37.  
  38. '//----------------------------------------------------
  39. '//determine which image the user wants to look at
  40. '//----------------------------------------------------
  41. if request.querystring("pic") <> "" and isnumber(request.querystring("pic")) then
  42.    lookUp = cint(request.querystring("pic"))
  43.    '//----------------------------------------------------
  44.    '// make sure the value of lookUp doesn't break
  45.    '// our array bounds
  46.    '//----------------------------------------------------
  47.    if (lookUp < 0 or lookUp > ubound(aFilenames)) then 
  48.       lookUp = 0
  49.    end if
  50. else
  51.    lookUp = 0
  52. end if
  53. %>
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3.    <img src="<%= IMAGE_DIRECTORY %><%= aFilenames(lookUp) %>" />
  4.    <br />
  5.    <a href="?pic=<%= lookUp - 1 %>"><< Previous</a> &nbsp; <a href="?pic=<%= lookUp + 1 %>">Next >></a>
  6.  
  7. </body>
  8. </html>
..

See to this code which i got from the form forum...
I think it will help u....
Dec 14 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3997
by: Susanna | last post by:
Hi all, I'm using the following slideshow script that I found on the web to display changing images with a crossfade effect. Eventually I will be adding many more images to the slideshow. The thing is, I ALSO have to make it so the images will load randomly. I have looked at a number of scripts for random-loading slideshows, but I have to find a way to COMBINE this fading-image script (or, a different fading-image script, if...
2
2102
by: Jeannie | last post by:
I have a popup window which is a slideshow of about 7 images. When the popup window loads, the first image is present and then the viewer can select next or previous to scroll through the rest of the images. I'd like to use the same popup window at different points throughout the website and have the Virtual Tour (slideshow) open up at the appropriate photos. Meaning I'd like to control which picture the popup window opens up to,...
8
2038
by: drillbit_99 | last post by:
I have an HTML page of thumbnail images. Each image can begin a slideshow of the images on the page by clicking on the image. This opens another HTML page that begins the slideshow using large images of the thumbnails. When the slideshow begins it always starts with the first image. I would like to pass the name of the thumbnail to the slideshow HTML page and begin the slideshow with the same image the user clicks on. Is this asking...
11
2408
by: David Graham | last post by:
Hi New to javascript. I'm trying to understand how a script at a website I come across works. http://www.BRPPISAFETY.COM Nearly got it but I have changed the variable called 'crossFadeDuration' to large numbers and small numbers but it doesn't seem to do anything. Could someone explain what effect changing this variable should bring about and why don't I see any changes. many thanks David
2
2548
by: Lanky | last post by:
I am using the Dynamic Ajax Content script from Dynamic Drive (http://dynamicdrive.com/dynamicindex17/ajaxcontent.htm) and trying to load the Ultimate Fade-In Slide Show also from Dynamic Drive (http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm.) Both work just fine independently, but the slide show script won't work when I try to load it with the Ajax Content Script - as if they are conflicting. Any ideas?
1
3348
by: ttamilvanan81 | last post by:
Hai everyone, I need to provide the slideshow for the images. I have upload the images into database. Then i will retrive all the images from the database and provide the slideshow for those images. I have try with the following jsp code. <%@ page language="java" %> <%@ page import="java.sql.*"%> <%@ page import="java.sql.Connection.*"%> <%@ page import="java.awt.image.*"%>
1
2292
pradeepjain
by: pradeepjain | last post by:
script> // (C) 2000 www.CodeLifter.com // http://www.codelifter.com // Free for all users, but leave in this header // NS4-6,IE4-6 // Fade effect only in IE; degrades gracefully // ======================================= // set the following variables // =======================================
0
9989
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9933
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9819
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8819
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7364
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3916
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3515
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.