Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body onload="randomBackground()">
- <script>
- function randomBackground()
- {
- var backgroundImages= new Array(
- "http://i.imgur.com/d4e92ws.jpg",
- "http://i.imgur.com/MtYTfi9.jpg",
- "http://i.imgur.com/3qFLfml.jpg"
- );
- var numberOfBackgrounds = backgroundImages.length
- var imagesIndex = Math.floor(Math.random()*numberOfBackgrounds);
- var backgroundUrl = backgroundImages[imagesIndex];
- document.body.style.backgroundImage = 'url(' +backgroundUrl +')';
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement