help needed in slideshow
-
Hello, I have made a small project in asp 1.1 which selects the file from a directory and shows all images with the help of array and datalist. I was also able to make previous next button. Now My problem is I want to make a auto slideshow, I don't have ajax. I don't have any idea of java too. Can any one kindly let me know how can i make it from an array of asp.net to javascript so that the slide show works. I preassume that can be done only in java. Or is there any way I can do it in asp.net codes. Can I also put a browse Button so that user can choose the directory he/she wants, as I am using a textbox to put the path from where it will pickup. Sorry for my ignorance I am learing now, kindly help. Thanks in advance
-
Hello, I have made a small project in asp 1.1 which selects the file from a directory and shows all images with the help of array and datalist. I was also able to make previous next button. Now My problem is I want to make a auto slideshow, I don't have ajax. I don't have any idea of java too. Can any one kindly let me know how can i make it from an array of asp.net to javascript so that the slide show works. I preassume that can be done only in java. Or is there any way I can do it in asp.net codes. Can I also put a browse Button so that user can choose the directory he/she wants, as I am using a textbox to put the path from where it will pickup. Sorry for my ignorance I am learing now, kindly help. Thanks in advance
I will give you a couple of pointers: If the directories are on the server, you have to build some server side control that loops over all the directories that you want the user to be able to print from, and print these to the screen. When the user selects a directory, the server gets all the filenames from that directory and using a loop prints it into a javascript that looks for example like this:
var images = new Array(5);
images[0] = new Array('/images/','image1.jpg','Some description maybe');
images[1] = new Array('/images/','image2.jpg','Some description maybe');
images[2] = new Array('/images/','image3.jpg','Some description maybe');
images[3] = new Array('/images/','image4.jpg','Some description maybe');
images[4] = new Array('/images/','image5.jpg','Some description maybe');So know on the client side you will have all the info to start working on your slideshow. Now the missing element for the slideshow, is some sort of a timer, that is where the
setTimeout()
drops in. Once the user clicks start slideshow, he calls to a function that looks like this:var isSlideshow = false;
function StartSlideShow()
{
isSlideshow = true;ShowPicture (0)
}
function ShowPicture(picId)
{
if (isSlideshow) {
document.getElementById("img").src = images[i][0] + images[i][1];
setTimeout('ShowPicture(' + picId + 1 + ')',2000); //call same function after 2 sec
}}
function StopSlideShow()
{
isSlideshow = false;
}Here you should have all your ingredients to start on your slideshow.
-
I will give you a couple of pointers: If the directories are on the server, you have to build some server side control that loops over all the directories that you want the user to be able to print from, and print these to the screen. When the user selects a directory, the server gets all the filenames from that directory and using a loop prints it into a javascript that looks for example like this:
var images = new Array(5);
images[0] = new Array('/images/','image1.jpg','Some description maybe');
images[1] = new Array('/images/','image2.jpg','Some description maybe');
images[2] = new Array('/images/','image3.jpg','Some description maybe');
images[3] = new Array('/images/','image4.jpg','Some description maybe');
images[4] = new Array('/images/','image5.jpg','Some description maybe');So know on the client side you will have all the info to start working on your slideshow. Now the missing element for the slideshow, is some sort of a timer, that is where the
setTimeout()
drops in. Once the user clicks start slideshow, he calls to a function that looks like this:var isSlideshow = false;
function StartSlideShow()
{
isSlideshow = true;ShowPicture (0)
}
function ShowPicture(picId)
{
if (isSlideshow) {
document.getElementById("img").src = images[i][0] + images[i][1];
setTimeout('ShowPicture(' + picId + 1 + ')',2000); //call same function after 2 sec
}}
function StopSlideShow()
{
isSlideshow = false;
}Here you should have all your ingredients to start on your slideshow.
let me first thank you for you help. I am sure I can do the slide show with your kind help. But I have one more question connected to it. I am using the codes below to get an save the path as well as the file name in asp.net code For Each s in directory.GetFiles(textbox.text.trim, "*.jpeg") How can i make the same type of array for the path and file in java. Thanks alot again.
-
let me first thank you for you help. I am sure I can do the slide show with your kind help. But I have one more question connected to it. I am using the codes below to get an save the path as well as the file name in asp.net code For Each s in directory.GetFiles(textbox.text.trim, "*.jpeg") How can i make the same type of array for the path and file in java. Thanks alot again.
I guess you mean javascript? Look if the folders you want to browse through are on the client side, you'll have a problem, since the browser is not allowed to do things like folder browsing etc (think of the security issues that would rise with such a feature). So then indeed you need to use Java to make a small applet that would browse folders on the harddrive. I'm not a Java expert, so I don't really know. If we talk about folders on the server, then you indeed have to loop on the serverside through all the folder and print them to the client in HTML.