Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

change image automaticly

let images = ['photoFromInternet', 'photoFromInternet2', 'photoFromInternet3'];

let index = 0;
const imgElement = document.querySelector('#mainPhoto');

function change() {
   imgElement.src = images[index];
   index > 1 ? index = 0 : index++;
}

window.onload = function () {
    setInterval(change, 5000);
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: loading react 
Javascript :: expo dependencies 
Javascript :: react chartjs 
Javascript :: row smaller than the container bootstrap react 
Javascript :: async and await 
Javascript :: see if array contains array javascript 
Javascript :: sum of an array 
Javascript :: permutation and combination program in javascript 
Javascript :: delete message plugin discord 
Javascript :: Update matched key values in two JavaScript objects 
Javascript :: Parse BSON to JSON 
Javascript :: format iso time in very human readable format js such as n seconds ago etc 
Javascript :: radio button not checked 
Javascript :: range number in js 
Javascript :: Creating with the custom hook in react 
Javascript :: react native material bottom tabs 
Javascript :: how to check characters inside a string javascript 
Javascript :: date picker type react 
Javascript :: textcontent javascript 
Javascript :: lodash remove not in array 
Javascript :: angular map 
Javascript :: javscript assert 
Javascript :: multiple class to same click jquery 
Javascript :: image to base64 js 
Javascript :: xml http request fetch 
Javascript :: remove last character of string in javascript 
Javascript :: factors of a number 
Javascript :: bind method in javascript 
Javascript :: hincrby nodejs 
Javascript :: object find javascript 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =