Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function randomImage() {
- var fileNames = [
- "image1.png",
- "image2.jpg",
- "image3.png"
- ];
- var randomIndex = Math.floor(Math.random() * fileNames.length);
- document.getElementById('#background').innerHTML = 'url(' +
- fileNames[randomIndex] + ')';
- }
- randomImage();
- setInterval(randomImage, 1000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement