Advertisement
Guest User

Untitled

a guest
Jan 28th, 2014
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <button onclick="setbackground()">Press button</button>
  6.  
  7. <script>
  8.  
  9. function setbackground()
  10. {
  11. window.setTimeout( "setbackground()", 15000);
  12.  
  13. var index = Math.round(Math.random() * 10);
  14.  
  15. var ColorValue = "FFFFFF";
  16.  
  17. if(index == 1)
  18. ColorValue = "003366";
  19. if(index == 2)
  20. ColorValue = "660066";
  21. if(index == 3)
  22. ColorValue = "FF0000";
  23. if(index == 4)
  24. ColorValue = "FFFF66";
  25. if(index == 5)
  26. ColorValue = "99FF33";
  27. if(index == 6)
  28. ColorValue = "00CC00";
  29. if(index == 7)
  30. ColorValue = "666633";
  31. if(index == 8)
  32. ColorValue = "3D9999";
  33. if(index == 9)
  34. ColorValue = "143333";
  35. if(index == 10)
  36. ColorValue = "1A1A80";
  37.  
  38. document.getElementsByTagName("body")[0].style.backgroundColor = "#" + ColorValue;
  39.  
  40. }
  41. </script>
  42.  
  43. </body>
  44. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement