-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
99 lines (93 loc) · 2.42 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE html>
<html>
<body>
<style>
#slidecontainer {
width: 100%;
}
.slider {
-webkit-appearance: none;
width: 100%;
height: 115px;
background: #d3d3d3;
outline: none;
opacity: 0.7;
-webkit-transition: .2s;
transition: opacity .2s;
}
.slider:hover {
opacity: 1;
}
.slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 25px;
height: 25px;
background: #4CAF50;
cursor: pointer;
}
.slider::-moz-range-thumb {
width: 25px;
height: 25px;
background: #4CAF50;
cursor: pointer;
}
</style>
<div class="w3-responsive">
<table class="w3-table w3-border" style="width:100%">
<tr>
<th>RED</th>
<th>GREEN</th>
<th>BLUE</th>
</tr>
<tr>
<td id="redvalue">255</td>
<td id="greenvalue">0</td>
<td id="bluevalue">0</td>
</tr>
<tr>
<td id="red" style="height:50px;background-color:red"></td>
<td id="green" style="background-color: rgb(0, 255, 0);"></td>
<td id="blue" style="background-color:blue"></td>
</tr>
<tr>
<td>
<input onchange="changeRed(this.value)" class="slider" type="range" id="slideRed" name="slideRed" value="255" min="0" max="255">
</td>
<td>
<input onchange="changeGreen(this.value)" class="slider" type="range" id="slideGreen" name="slideGreen" value="0" min="0" max="255">
</td>
<td>
<input onchange="changeBlue(this.value)" class="slider" type="range" id="slideBlue" name="slideBlue" value="0" min="0" max="255">
</td>
</tr>
</table>
</div>
<div id="change" style="height:300px">
<div id="changetxt" class="w3-large w3-padding-large w3-center”></div></div>
<div class="w3-center">
</div>
<script>
changeAll();
function changeRed(value) {
document.getElementById('redvalue').innerHTML = value;
changeAll();
}
function changeGreen(value) {
document.getElementById('greenvalue').innerHTML = value;
changeAll();
}
function changeBlue(value) {
document.getElementById('bluevalue').innerHTML = value;
changeAll();
}
function changeAll() {
var r = document.getElementById('redvalue').innerHTML;
var g = document.getElementById('greenvalue').innerHTML;
var b = document.getElementById('bluevalue').innerHTML;
document.getElementById('change').style.backgroundColor = "rgb(" + r + "," + g + "," + b + ")";
document.getElementById('changetxt').innerHTML = "rgb(" + r + ", " + g + ", " + b + ")";
}
</script>
</body>
</html>