View difference between Paste ID: PYzBnck0 and k5rYzQXK
SHOW: | | - or go back to the newest paste.
1
<!DOCTYPE html>
2
<html>
3
<head>
4
    <title></title>
5-
<button onclick="setbackground()">Press button</button>
5+
</head>
6
<body>
7
8
<button id="myButton">Press button</button>
9-
function setbackground()
9+
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
10-
{
10+
11-
window.setTimeout( "setbackground()", 15000);
11+
    $('#myButton').on('click', setBackground);
12
13-
var index = Math.round(Math.random() * 10);
13+
    function setBackground() {
14
        window.setTimeout(setBackground, 1500);
15-
var ColorValue = "FFFFFF";
15+
16
        var index = Math.round(Math.random() * 10);
17-
if(index == 1)
17+
18-
ColorValue = "003366";
18+
        var ColorValue = "FFFFFF";
19-
if(index == 2)
19+
20-
ColorValue = "660066";
20+
        if (index == 1) ColorValue = "003366";
21-
if(index == 3)
21+
        if (index == 2) ColorValue = "660066";
22-
ColorValue = "FF0000";
22+
        if (index == 3) ColorValue = "FF0000";
23-
if(index == 4)
23+
        if (index == 4) ColorValue = "FFFF66";
24-
ColorValue = "FFFF66";
24+
        if (index == 5) ColorValue = "99FF33";
25-
if(index == 5)
25+
        if (index == 6) ColorValue = "00CC00";
26-
ColorValue = "99FF33";
26+
        if (index == 7) ColorValue = "666633";
27-
if(index == 6)
27+
        if (index == 8) ColorValue = "3D9999";
28-
ColorValue = "00CC00";
28+
        if (index == 9) ColorValue = "143333";
29-
if(index == 7)
29+
        if (index == 10) ColorValue = "1A1A80";
30-
ColorValue = "666633";
30+
31-
if(index == 8)
31+
        $("body").css('backgroundColor', "#" + ColorValue);
32-
ColorValue = "3D9999";
32+
    }
33-
if(index == 9)
33+
34-
ColorValue = "143333";
34+
35-
if(index == 10)
35+