-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
35 lines (28 loc) · 1.02 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!--
Random Colours by Taavi Larionov
ver 1.0
-->
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Random colours</title>
<script src="http:////ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
jQuery(window).load(function(){
var x=Math.floor((Math.random()*256)+0);
var y=Math.floor((Math.random()*256)+0);
var z=Math.floor((Math.random()*256)+0);
var element = document.getElementById('paintme');
element.style.background = 'rgb(' + x + ',' + y + ',' + z + ')';
document.body.style.backgroundColor = 'rgb(' + x + ',' + y + ',' + z + ')';
console.log(x, y, z);
});
</script>
</head>
<body>
<p class="i_want_colour">Radom Colour Generator will generate random colours as rgb(x, y, z) <span id="paintme" style="width: 15px; height: 15px; display: block; border: solid 1px #000; background: red;"></span></p>
<input type="button" value="Generate another totally random color" onClick="document.location.reload(true)">
</body>
</html>