Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <button onclick="setbackground()">Press button</button>
- <script>
- function setbackground()
- {
- window.setTimeout( "setbackground()", 15000);
- var index = Math.round(Math.random() * 10);
- var ColorValue = "FFFFFF";
- if(index == 1)
- ColorValue = "003366";
- if(index == 2)
- ColorValue = "660066";
- if(index == 3)
- ColorValue = "FF0000";
- if(index == 4)
- ColorValue = "FFFF66";
- if(index == 5)
- ColorValue = "99FF33";
- if(index == 6)
- ColorValue = "00CC00";
- if(index == 7)
- ColorValue = "666633";
- if(index == 8)
- ColorValue = "3D9999";
- if(index == 9)
- ColorValue = "143333";
- if(index == 10)
- ColorValue = "1A1A80";
- document.getElementsByTagName("body")[0].style.backgroundColor = "#" + ColorValue;
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement