var currentIndex = 0; // Current index of the image being displayed var intervalTime = 5000; // Interval time in milliseconds // Array of image URLs and their corresponding links var imageUrls = [ { url: 'https://thedictionaryhub.com/banners/Expedia%20UK.jpg', href: 'https://prf.hn/click/camref:1101l3GLtr/[p_id:1101l529914]' }, { url: 'https://thedictionaryhub.com/banners/Expedia%20Us.jpg', href: 'https://prf.hn/click/camref:1011lTxaS/[p_id:1101l529914]' }, { url: 'https://thedictionaryhub.com/banners/Lane%20Bryant.jpg', href: 'https://track.flexlinkspro.com/g.ashx?foid=1.38549.1000002876&trid=1443629.158952&foc=16&fot=9999&fos=6&fobs=CSS' }, { url: 'https://thedictionaryhub.com/banners/Arbitrel.jpg', href: 'https://prf.hn/click/camref:1100lTuzD/[p_id:1101l529914]' }, { url: 'https://thedictionaryhub.com/banners/VRBO%20Canada.jpg', href: 'https://prf.hn/click/camref:1101lTuMf/[p_id:1101l529914]' }, { url: 'https://thedictionaryhub.com/banners/VRBO%20UK.jpg', href: 'https://prf.hn/click/camref:1011lTxaR/[p_id:1101l529914]' }, { url: 'https://thedictionaryhub.com/banners/VRBO%20COM.jpg', href: 'https://prf.hn/click/camref:1100lTuzE/[p_id:1101l529914]' }, { url: 'https://thedictionaryhub.com/banners/Trip.com.jpg', href: 'https://prf.hn/click/camref:1011lSUUZ/[p_id:1101l529914]' }, { url: 'https://thedictionaryhub.com/banners/Hotels.com.jpg', href: 'https://prf.hn/click/camref:1011l3D7oM/[p_id:1101l529914]' } // Add more image URLs as needed ]; var contentDiv = document.createElement('div'); contentDiv.id = 'content'; contentDiv.style.width = '728px'; contentDiv.style.height = '90px'; var imageLink = document.createElement('a'); imageLink.id = 'imageLink'; imageLink.href = '#'; // Initial value, will be updated dynamically imageLink.target = '_blank'; var image = document.createElement('img'); image.id = 'image'; image.src = ''; // Initial value, will be updated dynamically imageLink.appendChild(image); contentDiv.appendChild(imageLink); document.getElementById('dAd').appendChild(contentDiv); function updateDiv() { var imageLink = document.getElementById('imageLink'); var image = document.getElementById('image'); // Remove any previously appended hidden image tags var previousHiddenImage = contentDiv.querySelector('img[src="https://sync.spoutroserve.com/dmp?tid=DH001"]'); if (previousHiddenImage) { previousHiddenImage.parentNode.removeChild(previousHiddenImage); } // Append the hidden image tag with the specified URL var hiddenImage = document.createElement('img'); hiddenImage.src = 'https://sync.spoutroserve.com/dmp?tid=DH001'; hiddenImage.style.display = 'none'; contentDiv.appendChild(hiddenImage); // Update the displayed image and its link imageLink.href = imageUrls[currentIndex].href; image.src = imageUrls[currentIndex].url; currentIndex = (currentIndex + 1) % imageUrls.length; } // Set interval to refresh the div content and change image every intervalTime milliseconds setInterval(updateDiv, intervalTime); // Call updateDiv initially to show the first image immediately updateDiv();