473,387 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Cycling through images on a timer

I have a series of images called shacam1, shacam2..... shacam(n) I
want these to appear on my blog as if they were a feed from a webcam. I
need a little piece of code to select a random image to start from and
to then cycle through the images in order, refreshing every 5000ms.
Help?

Nov 9 '05 #1
2 1845
Sha Crawford wrote on 09 nov 2005 in comp.lang.javascript:
I have a series of images called shacam1, shacam2..... shacam(n) I
want these to appear on my blog as if they were a feed from a webcam. I
need a little piece of code to select a random image to start from and
to then cycle through the images in order, refreshing every 5000ms. Help?


Sure, show us your code, and where you go wrong.

Programme it for you?

No, not me, you'll have to pay someone
or find a kind soul on the way,
or search Google.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Nov 9 '05 #2
Sha Crawford wrote:
I have a series of images called shacam1, shacam2..... shacam(n) I
want these to appear on my blog as if they were a feed from a webcam. I
need a little piece of code to select a random image to start from and
to then cycle through the images in order, refreshing every 5000ms.
Help?


I'll give you a few hints.

When the page is loaded, you want to:

* Load the list of images
* Pick a random offset
* Load the next image. This task consists of:
* Setting your <img> element's src attribute
* Advancing the offset into the list by 1, resetting it to the
beginning if it's at the end of the list
* Setting a timer to load the next image 5 seconds later

If I'm understanding your question correctly, that's almost a
line-for-line translation of the JavaScript for achieving what you
want. Now go do some research and implement it yourself. The
setTimeout() and Math.random() functions and the % operator will be
particularly useful.

-- David

Nov 9 '05 #3

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

Similar topics

1
by: parksch2 | last post by:
Does anyone currently use image files in the <enclosure> tag on the item level in RSS 2.0? I have summary images associated with each item that I would like to put in my RSS feed. I tried to test...
1
by: Mr. Orange | last post by:
I've found this might not really be possible to do with js, but I'm not really versed enough in it to know for sure. I have a web cam saving an image to a server, "cam.jpg". The cam replaces...
3
by: robbiehenry | last post by:
1. robbiehe...@gmail.com Sep 19, 1:48 pm show options From: robbiehe...@gmail.com - Find messages by this author Date: Mon, 19 Sep 2005 10:48:50 -0700 Local: Mon, Sep 19 2005 1:48 pm...
2
by: Dev | last post by:
Dear Friends, I have 20 images in Array list.How do display the images into picture box every 1 second.If anyone knows please let me know....I don't want reload the form.The images are comming...
10
by: Ryan | last post by:
I'm creating a website that monitors the status of servers using My.Computer.Network.Ping. I'm looking for a way to fire off my Ping() function every second or so. I see a Timer control...
1
by: Tarik Monem | last post by:
Hi guys, As usual, I've found some code from the net, changed it around, added some things and it works, but not exactly the way that I'd like it to work. I want it to work like the app on...
7
by: genesistr | last post by:
Hi, I have timer class and some classes use timer. but when i come back from timer with callback function, i can see this. properties. function Timer(dName, dCallback){ this.timer = null;...
6
by: dantz | last post by:
HI everyone, I hope someone can help me on this. I have form application that has 3 Timers that does an animation (changing an image for every interval) Each image are loaded at start of...
33
sword117
by: sword117 | last post by:
Im trying to create a video background using frames from a video, and using a timer to run the frames 30FPS , can someone help me out? its for a school project. im here so far, i can make this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...

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.