473,662 Members | 2,575 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

making slideshow images blend and rotate

I ran across a chunk of code that allows me to blend images in and out
(works great!) but now I need to figure out a way to randomize the
order that these images appear. I have a bunch of pics and I'd like
to give them all a fair shot at getting seen =)

Any help would be GREATLY appreciated!!

Here's the code:

<HEAD>

<script language="JavaS cript1.1">
<!--

//specify interval between slide (in mili seconds)
var slidespeed=3000

//specify images
var slideimages=new Array("image1.g if","image2.gif ","image3.g if")

//specify corresponding links
var slidelinks=new Array("http://www.whatever.co m","http://whatnever.com", "http://www.always.com" )

var newwindow=1 //open links in new window? 1=yes, 0=no

var imageholder=new Array()
var ie=document.all
for (i=0;i<slideima ges.length;i++) {
imageholder[i]=new Image()
imageholder[i].src=slideimage s[i]
}

function gotoshow(){
if (newwindow)
window.open(sli delinks[whichlink])
else
window.location =slidelinks[whichlink]
}

//-->
</script>

</HEAD>

<BODY>

<a href="javascrip t:gotoshow()">< img src="image1.gif " name="slide"
border=0 style="filter:b lendTrans(durat ion=3)" width=97
height=100></a>

<script language="JavaS cript1.1">
<!--

var whichlink=0
var whichimage=0
var blenddelay=(ie) ? document.images .slide.filters[0].duration*1000 :
0
function slideit(){
if (!document.imag es) return
if (ie) document.images .slide.filters[0].apply()
document.images .slide.src=imag eholder[whichimage].src
if (ie) document.images .slide.filters[0].play()
whichlink=which image
whichimage=(whi chimage<slideim ages.length-1)? whichimage+1 : 0
setTimeout("sli deit()",slidesp eed+blenddelay)
}
slideit()

//-->
</script>
Jul 23 '05 #1
2 5398
Lee
Whitney said:

I ran across a chunk of code that allows me to blend images in and out
(works great!) but now I need to figure out a way to randomize the
order that these images appear. I have a bunch of pics and I'd like
to give them all a fair shot at getting seen =)
//specify images
var slideimages=new Array("image1.g if","image2.gif ","image3.g if")


function shuffle(arr) {
for (var i = arr.length - 1; i > 0; i--) {
// Interchange element i with a random element not after it
var j = Math.floor((i + 1) * Math.random());
var t = arr[i];
arr[i] = arr[j];
arr[j] = t;
}
}

shuffle(slideim ages);

Jul 23 '05 #2
works perfectly! thanks a million!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3

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

Similar topics

2
3991
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
2095
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
2030
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...
2
14912
by: jkbarbee37 | last post by:
I've done enough poking around lately to realise that there is a deficiency in Firefox when it comes to using document.images to reference an image for the purpose of building a slideshow. The code below works as I expected in IE, but just sits there in Firefox: <html> <head> <script language="JavaScript" type="text/javascript"> <!-- theimages = new...
11
2398
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
4
3456
by: ShieldsJared | last post by:
Im looking for help making a good GUI out of pure images. I would like to embed the common controls and such, but I want to make a nice looking GUI, similar to that of, say Windows Media Player. I'm not sure how to make an image "clickable", nor do I know how to make rollovers and such. Also looking for pointers on making the images blend well when sitting on top of each other. Any ideas? Thanks for your input!
1
3341
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.*"%>
2
3132
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
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8344
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
8857
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...
0
8764
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
8546
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
7367
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
5654
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();...
2
1993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1752
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.