Image Changing | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Image Changing

Hey how can I change the source of an image in html using JavaScript I tried the document.get ElementByID(). src = some link; and I also tried using the set interval and clearinterval to continuously change between two images but it did not work only once the image came and then the previous image did not come back. look at this this is my code and please help https://code.sololearn.com/WGR141b6B7oL/?ref=app

27th Sep 2017, 11:44 AM
Abhay Jha
Abhay Jha - avatar
2 Answers
+ 2
Just use one timer to switch images: https://code.sololearn.com/WJ0oRKl4wE8L/?ref=app
27th Sep 2017, 12:40 PM
Calviղ
Calviղ - avatar
+ 2
thanks
27th Sep 2017, 2:59 PM
Abhay Jha
Abhay Jha - avatar