Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script>
- function random_background(){
- let red = Math.floor(Math.random() * 256);
- let green = Math.floor(Math.random() * 256);
- let blue = Math.floor(Math.random() * 256);
- let randomcolor = "rgb(" + red + "," + green + "," + blue + ")";
- console.log(randomcolor);
- document.body.style.background = randomcolor;
- }
- </script>
- <input type="button" value="randomize" onclick="setInterval(random_background, 1000);">
- </head>
- <body>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement