-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslider.html
188 lines (171 loc) · 6.25 KB
/
slider.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.slidecontainer {
width: 100%;
}
span, input { font-size: 3em;}
.slider {
-webkit-appearance: none;
width: 80%;
height: 30px;
border-radius: 5px;
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;
border-radius: 50%;
background: #4CAF50;
cursor: pointer;
}
.slider::-moz-range-thumb {
width: 25px;
height: 25px;
border-radius: 50%;
background: #4CAF50;
cursor: pointer;
}
</style>
</head>
<body>
<p>Average<span id="rendite">100</span></p>
<p>weighted_stronger<span id="grendite">100</span></p>
<p>weighted_kostant<span id="krendite">100</span> over a period of <input value="10" size="5"></input>years, anually weight adjustment.</p>
<div class="slidecontainer">
<span id="g1">8.33</span><input type="range" min="1" max="500" value="100" class="slider" id="s1"><span id="w1">100</span> <span id="w1_g">: 100</span><br>
<span id="g2">8.33</span><input type="range" min="1" max="500" value="100" class="slider" id="s2"><span id="w2">100</span><br>
<span id="g3">8.33</span><input type="range" min="1" max="500" value="100" class="slider" id="s3"><span id="w3">100</span><br>
<span id="g4">8.33</span><input type="range" min="1" max="500" value="100" class="slider" id="s4"><span id="w4">100</span><br>
<span id="g5">8.33</span><input type="range" min="1" max="500" value="100" class="slider" id="s5"><span id="w5">100</span><br>
<span id="g6">8.33</span><input type="range" min="1" max="500" value="100" class="slider" id="s6"><span id="w6">100</span><br>
<span id="g7">8.33</span><input type="range" min="1" max="500" value="100" class="slider" id="s7"><span id="w7">100</span><br>
<span id="g8">8.33</span><input type="range" min="1" max="500" value="100" class="slider" id="s8"><span id="w8">100</span><br>
<span id="g9">8.33</span><input type="range" min="1" max="500" value="100" class="slider" id="s9"><span id="w9">100</span><br>
<span id="g10">8.33</span><input type="range" min="1" max="500" value="100" class="slider" id="s10"><span id="w10">100</span><br>
<span id="g11">8.33</span><input type="range" min="1" max="500" value="100" class="slider" id="s11"><span id="w11">100</span><br>
<span id="g12">8.33</span><input type="range" min="1" max="500" value="100" class="slider" id="s12"><span id="w12">100</span><br>
</div>
<script>
var rendite = document.getElementById("rendite");
var grendite = document.getElementById("grendite");
var krendite = document.getElementById("krendite");
krendite.innerHTML = "noch nicht realisiert";
var s1 = document.getElementById("s1");
var s2 = document.getElementById("s2");
var s3 = document.getElementById("s3");
var s4 = document.getElementById("s4");
var s5 = document.getElementById("s5");
var s6 = document.getElementById("s6");
var s7 = document.getElementById("s7");
var s8 = document.getElementById("s8");
var s9 = document.getElementById("s9");
var s10 = document.getElementById("s10");
var s11 = document.getElementById("s11");
var s12 = document.getElementById("s12");
function durchschnitt() {
rendite.innerHTML = (( parseInt(s1.value) + parseInt(s2.value) + parseInt(s3.value) + parseInt(s4.value) + parseInt(s5.value) + parseInt(s6.value) + parseInt(s7.value) + parseInt(s8.value) + parseInt(s9.value) + parseInt(s10.value) + parseInt(s11.value) + parseInt(s12.value) ) / 12 ).toFixed(1);
gdurchschnitt();
}
function gdurchschnitt() {
var gesamtper = parseInt(s1.value) + parseInt(s2.value) + parseInt(s3.value) + parseInt(s4.value) + parseInt(s5.value) + parseInt(s6.value) + parseInt(s7.value) + parseInt(s8.value) + parseInt(s9.value) + parseInt(s10.value) + parseInt(s11.value) + parseInt(s12.value) ;
var anteils1 = parseInt(s1.value) / (gesamtper / 100);
g1.innerHTML = anteils1.toFixed(2);
var anteils2 = parseInt(s2.value) / (gesamtper / 100);
g2.innerHTML = anteils2.toFixed(2);
var anteils3 = parseInt(s3.value) / (gesamtper / 100);
g3.innerHTML = anteils3.toFixed(2);
var anteils4 = parseInt(s4.value) / (gesamtper / 100);
g4.innerHTML = anteils4.toFixed(2);
var anteils5 = parseInt(s5.value) / (gesamtper / 100);
g5.innerHTML = anteils5.toFixed(2);
var anteils6 = parseInt(s6.value) / (gesamtper / 100);
g6.innerHTML = anteils6.toFixed(2);
var anteils7 = parseInt(s7.value) / (gesamtper / 100);
g7.innerHTML = anteils7.toFixed(2);
var anteils8 = parseInt(s8.value) / (gesamtper / 100);
g8.innerHTML = anteils8.toFixed(2);
var anteils9 = parseInt(s9.value) / (gesamtper / 100);
g9.innerHTML = anteils9.toFixed(2);
var anteils10 = parseInt(s10.value) / (gesamtper / 100);
g10.innerHTML = anteils10.toFixed(2);
var anteils11 = parseInt(s11.value) / (gesamtper / 100);
g11.innerHTML = anteils11.toFixed(2);
var anteils12 = parseInt(s12.value) / (gesamtper / 100);
g12.innerHTML = anteils12.toFixed(2);
grendite.innerHTML = ((
anteils1 * parseInt(s1.value) +
anteils2 * parseInt(s2.value) +
anteils3 * parseInt(s3.value) +
anteils4 * parseInt(s4.value) +
anteils5 * parseInt(s5.value) +
anteils6 * parseInt(s6.value) +
anteils7 * parseInt(s7.value) +
anteils8 * parseInt(s8.value) +
anteils9 * parseInt(s9.value) +
anteils10 * parseInt(s10.value) +
anteils11 * parseInt(s11.value) +
anteils12 * parseInt(s12.value) ) / 100 ).toFixed(1);
w1_g.innerHTML = "muss berechnet werden";
}
s1.oninput = function() {
w1.innerHTML = s1.value;
durchschnitt();
}
s2.oninput = function() {
w2.innerHTML = s2.value;
durchschnitt();
}
s3.oninput = function() {
w3.innerHTML = s3.value;
durchschnitt();
}
s4.oninput = function() {
w4.innerHTML = s4.value;
durchschnitt();
}
s5.oninput = function() {
w5.innerHTML = s5.value;
durchschnitt();
}
s6.oninput = function() {
w6.innerHTML = s6.value;
durchschnitt();
}
s7.oninput = function() {
w7.innerHTML = s7.value;
durchschnitt();
}
s8.oninput = function() {
w8.innerHTML = s8.value;
durchschnitt();
}
s9.oninput = function() {
w9.innerHTML = s9.value;
durchschnitt();
}
s10.oninput = function() {
w10.innerHTML = s10.value;
durchschnitt();
}
s11.oninput = function() {
w11.innerHTML = s11.value;
durchschnitt();
}
s12.oninput = function() {
w12.innerHTML = s12.value;
durchschnitt();
}
</script>
</body>