The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Simple alternating images at constant intervals
lelos1
post Sep 4 2016, 01:19 PM
Post #1





Group: Members
Posts: 2
Joined: 4-September 16
Member No.: 24,809



Hello everyone!

I am new to coding and I need some help displaying some images. What I wanna do,
is create a very basic image alternation tool. Every 20 seconds I want my html file to show another image.
I found something like this, but I don't know how to make it work, so that it displays one of them, after
the given time is past.

<html>
<script type="text/javascript">
var interval_time = 200;
setInterval(your_function,interval_time);
function your_function(){
var imgCount = 3;
var dir = 'images/';
var images = new Array
images[1] = "1.jpg",
images[2] = "2.jpg",
images[3] = "3.jpg",
</html>

Thanks a lot for your time
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Sep 4 2016, 03:31 PM
Post #2


Programming Fanatic
********

Group: Members
Posts: 1,981
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



If you want a 20 second delay then you must multiply 20*1000 = 20000. 1000 is 1 second, so change this:
CODE
var interval_time = 200;
to this:
CODE
var interval_time = 20000;


This post has been edited by CharlesEF: Sep 4 2016, 03:32 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 18th April 2024 - 09:53 PM