Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
random image slide show not working
Old 03-02-2010, 01:31 AM random image slide show not working
ericson3000's Avatar
Experienced Talker

Posts: 40
Name: Bob Davis
Location: Los Angeles, CA
Trades: 0
When I preload my images via an Array, my automatic slide show doesn't work. My code is below. Any help is appreciated.

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>JS - Image Object - Creating a Random Image Slide Show</title>

<script type="text/javascript">
<!--
var imageList = new Array ();
imageList[0] = new Image ();
imageList[0].src = "_external_files/Image1.jpg";
imageList[1] = new Image ();
imageList[1].src = "_external_files/Image2.jpg";
imageList[2] = new Image ();
imageList[2].src = "_external_files/Image3.jpg";
imageList[3] = new Image ();
imageList[3].src = "_external_files/Image4.jpg";
//-->
</script>

</head>

<body>

<img src="_external_files/Image1.jpg" name="slideShow" width="600" height="400" alt="people and things" />

<script type="text/javascript">
<!--
function slideShow () {
var imageNumber = (Math.floor(Math.random () * imageList.length)); // determines a random image number
document.images.slideShow.src = imageList[imageNumber];
window.setTimeout ("slideShow ();", 3000);
}
window.setTimeout ("slideShow ();", 3000);
slideShow ();
//-->
</script>

</body>
</html>
ericson3000 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-02-2010, 02:50 AM Re: random image slide show not working
Douglife's Avatar
Extreme Talker

Posts: 218
Name: Douglas Montgomery
Location: Florida
Trades: 0
I may be mistaken, but I don't see you calling it anywhere, other than
Code:
<img src="_external_files/Image1.jpg" name="slideShow" width="600" height="400" alt="people and things" />
which would need to be in a DIV tag, calling the script.

Consider using JQuery for the desired effect. http://cssglobe.com/post/3783/jquery...content-slider

You can see how I used the same plugin at www.douglife.com
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Douglife is offline
Reply With Quote
View Public Profile Visit Douglife's homepage!
 
Old 03-02-2010, 03:47 AM Re: random image slide show not working
ericson3000's Avatar
Experienced Talker

Posts: 40
Name: Bob Davis
Location: Los Angeles, CA
Trades: 0
thanks for the reply. I actually figured it out. I just forgot to put the .src at the end of document.images.slideShow.src = imageList[imageNumber]

i'll take a look at the jquery though.
ericson3000 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to random image slide show not working
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.39873 seconds with 12 queries