473,598 Members | 3,266 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Slide Show Redirection

Hi,

I'm trying run an image slide show where the images rotate once each,
then after the last image in the array has been displayed for the
specified amount of time, a redirection to another page occurs. The
problem I'm having is that the redirection happens as soon as the last
image is displayed.

Here's an example of a normal version where the images rotate
continuously and the redirect version that isn't working properly:

http://www.xlectric.com/ftb/images/stest.html

Is there something I'm doing wrong with the counter or the if statement
that causes the redirect ?

Any help/suggestions will be appreciated.

Later, Art.

Jul 23 '05 #1
3 4020
"Wazz Up" <Mi********@web tv.net> wrote in message
news:63******** *******@storefu ll-3156.bay.webtv. net...
Hi,

I'm trying run an image slide show where the images rotate once each,
then after the last image in the array has been displayed for the
specified amount of time, a redirection to another page occurs. The
problem I'm having is that the redirection happens as soon as the last
image is displayed.

Here's an example of a normal version where the images rotate
continuously and the redirect version that isn't working properly:

http://www.xlectric.com/ftb/images/stest.html

Is there something I'm doing wrong with the counter or the if statement
that causes the redirect ?

Any help/suggestions will be appreciated.

Later, Art.


On the Redirect page I get an error at:
pre_img.src = s_imgs[s_pre].src;
because "s_pre" is 5.

I took the liberty of modifying your code and it now works for me.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Slide Redirect</title>
<meta name="title" content="Slide Redirect" />
<meta name="descripti on" content="" />
<meta name="keywords" content="" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<base href="http://www.xlectric.co m/ftb/images/sredirect.html" />
<script type="text/javascript">
// Xlectric Script
var s_count = 0;
var s_imgs = new Array();
s_imgs[0] = new Image();
s_imgs[0].src = "ftb01look1.jpg ";
s_imgs[1] = new Image();
s_imgs[1].src = "ftb02look2.jpg ";
s_imgs[2] = new Image();
s_imgs[2].src = "ftb03yawn1.jpg ";
s_imgs[3] = new Image();
s_imgs[3].src = "ftb04look3.jpg ";
s_imgs[4] = new Image();
s_imgs[4].src = "ftb05argue1.jp g";
var pre_img = new Image();
function slideShow() {
if (s_count >= s_imgs.length) {
window.location .href = 'sdest.html';
return;
}
document.sbase. src = s_imgs[s_count].src;
s_count++;
setTimeout("sli deShow();",2000 );
}
</script>
<link rel="stylesheet " href="stest.css " type="text/css" />
</head>
<body onload="slideSh ow();">
<div class="ctr">
<p>Rotation With Redirect</p>
<img src="ftb01look1 .jpg" name="sbase" width="400" height="220" border="0"
alt="From The Birds" />
</div>
</body>
</html>

1) "s_imgs" can be declared outside of the function.

2) I didn't understand what the following was for so I removed it:

var s_pre = 1;

pre_img.src = s_imgs[s_pre].src;
s_pre++;

if (s_pre >= s_imgs.length - 1)
{
pre_img.src = "../thebirds400x218 .jpg";
}

3) I changed 'window.locatio n.replace('sdes t.html');' to:

window.location .href = 'sdest.html';
return;
Jul 23 '05 #2
Lee
Wazz Up said:

Hi,

I'm trying run an image slide show where the images rotate once each,
then after the last image in the array has been displayed for the
specified amount of time, a redirection to another page occurs. The
problem I'm having is that the redirection happens as soon as the last
image is displayed.

Here's an example of a normal version where the images rotate
continuously and the redirect version that isn't working properly:

http://www.xlectric.com/ftb/images/stest.html

Is there something I'm doing wrong with the counter or the if statement
that causes the redirect ?


document.sbase. src = s_imgs[s_count].src;
s_count++;

if (s_count >= s_imgs.length)
{
window.location .replace('sdest .html');
}

When you execute that first line with s_count indexing your last
image, that image is displayed, and then s_count is incremented
and then you test to see if it is >= s_imgs.length (it will be)
and so you redirect.

Re-arrange those lines like this:

if (s_count >= s_imgs.length)
{
window.location .replace('sdest .html');
}
else
{
document.sbase. src = s_imgs[s_count].src;
s_count++;
}

Jul 23 '05 #3
Thanks very much to both of you for your help and explanations. They
work like a charm ! Looks like part of the problem is that I put the
cart in front of the horse. Never really knew what that meant until just
now. lol

Outside of return true and return false for rollovers and onclicks, I'm
not to clear on using return in a function. All I know is if a condition
is met, I can use return to exit the function.

I put s_imgs inside the function to prevent them from preloading all at
once. I'm trying to preload them one at a time, in a sequence that's one
ahead of the image that is currently being displayed. My attempt to
accomplish that is to create a new Image() constructor (var pre_img =
new Image();) and assign an increment value to it that is one greater
than the image that is being displayed in the sbase image tag (using var
s_pre = 1;). That is a complete shot in the dark on my part. It does
work with WebTV and a PC with dial-up and a slow processor though. But
then again, that might be considered improper and/or a hack, so I'm open
to any suggestions you may have.

I shouldn't have used location.replac e() for these examples, sorry about
that. I grabbed it in a hurry from an iframe slide show that I have.
Using it in that (iframe) context is good though, as it eliminates
excessive use of the back button by replacing the current page in the
history with the next one.

Once again, thanks much for the help. Means everything to me.

Later, Art.

Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3463
by: Al Davis | last post by:
Note: I tried cross-posting this message to several newsgoups, including comp.lang.perl.misc, c.l.p.moderated, comp.infosystems.www.authoring.cgi, comp.lang.javascript and comp.lang.php. Nothing appeared on my news server, so I'm trying again - this time posting a separate copy of the message to each group. I'm thinking this should be fairly easy to accomplish - a quick and dirty ... what? ... script? program?
9
12389
by: Michael Burtenshaw | last post by:
I would like to make a slide show using random images. The problem is my host is 250.com, and they don't support cgi-programs. Is there another way to accomplish random images?
7
3049
by: 7mary4 | last post by:
I am working on a kiosk for a museum, we will be using firefox as the browser, with windows, and a touch screen. We'd like to create a slide show of a small portfolio when the visitors click down to the lowest level of the collection. For instance, after choosing Africa, then Sudan, they will choose what they would like to look at: jewelry, tapestry, metals, etc. When they choose tapestry, there will be groups of ten thumbnails. These...
3
2341
by: B Maxey | last post by:
I am storing images in a database and need a way to browse those files. I can load the files into an image list or whatever the control needs, but I need a control. It doesn't seem that any of the standard window controls would work, but I am thinking I can just draw all the images on an panel (or a browser form for that matter). Does anyone have any advice?
7
3058
by: Rudy | last post by:
Hello All! After working in the television industry, moving to a developing career has been interesting to say the least. 3 years of developing with books, and the help of you fine folks on this forum, I have learned quite a bit. But that doesn't mean anything when your looking for your first developing gig. 15 years in television production, and not having a college degree in Computer Science does not make me a very good prospect....
0
1804
by: cheenusri | last post by:
Hello friends, i am running slide show(pps file) in vb.net form using webbrowser control in it.while running the form, if right click on the slide, it show some popup menu, here i wan to disable all mouse click events on slide show which is inside the webbrowser control, i tried all the ways, but cant disable it.If anyone know the result ,please give me the solutions....
0
1561
by: Ed Sproull [MSFT] | last post by:
I have an ASP site (www.elsphoto.com} and I have several pages that have slide shows on them. The home page uses JPGs from a directory and the Family, Wedding and Pets pages retrieve the photos from the database. Each page shows the first slide correctly and the second slide always shows up as a thumbnail. After the show completes once, the second itteration all slides show correctly. I'm using a timer to trigger the slide change and...
1
13912
by: mumbaisalsa | last post by:
hi all, i want to run the slide show say ten slides and then close it , but in my code given below it opens the slide show and closes immediately ... .. please give me a solution to this problem 1. Please add MsPowerpoint11.0 object present in COM in ur references. 2. Code : -- Dim appPowerpoint as Powerpoint.Application
2
2133
by: vineetbindal | last post by:
Hi all, We have a slide show in a page which shows slids rotating after every 8-10 seconds with some descriptions about them. The problem is if the connection speed is slow then the page loads fine but that slide show takes a lot of time to load and (the place we are running the slide show is white blank page till than) I dont understand why. can someone tell me what can we do for this. i have think of something like
0
7899
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8392
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8050
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
8264
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
6718
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...
0
5438
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
3897
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3939
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1250
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.