0% found this document useful (0 votes)
8 views2 pages

Dynamic Image Fetching Script

The document contains code to fetch images from URLs every 10 seconds and add them to the DOM by creating elements and appending them to the body. It clears existing content first and increments a counter variable for the image filenames.

Uploaded by

Aleksandar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Dynamic Image Fetching Script

The document contains code to fetch images from URLs every 10 seconds and add them to the DOM by creating elements and appending them to the body. It clears existing content first and increments a counter variable for the image filenames.

Uploaded by

Aleksandar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

function finalLogic(url){

//body
let myBody = [Link]("body")[0];

//holder creation
let holder = [Link]("div");
[Link] = "holder";

//img creation
let img = [Link]("IMG");
[Link] = url;

//appending
[Link](img);
[Link](holder);

setInterval(function(){

let myBody = [Link]("body")[0];

// remove elements from body tag


if(![Link]("removed")){
[Link] = "";
[Link]("removed", "true");
}

//counter creation
if(![Link]("counter")){
let counter = [Link]("DIV");
[Link]("id", "counter");
[Link] = "4";
[Link] = "none";
[Link](counter);
}

let index = [Link]("counter").innerHTML;

fetch(`[Link]
[Link]`)
.then(response => {
if([Link] == 200){
[Link]([Link]);
finalLogic([Link]);
}
});

fetch(`[Link]
[Link]`)
.then(response => {
if([Link] == 200){
[Link]([Link]);
finalLogic([Link]);
}
});
fetch(`[Link]
[Link]`)
.then(response => {
if([Link] == 200){
[Link]([Link]);
finalLogic([Link]);
}
});

fetch(`[Link]
[Link]`)
.then(response => {
if([Link] == 200){
[Link]([Link]);
finalLogic([Link]);
}
});

}, 10000);

You might also like