-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
88 lines (74 loc) · 2.08 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
<!DOCTYPE html>
<html>
<head>
<title>surebet calculator</title>
<style>
th, td {
padding: 15px;
}
input {
width: 100px;
height: 50px;
align-items: center;
}
</style>
</head>
<body>
<table>
<tr>
<th></th>
<th>odds</th>
<th>stake</th>
<th>result</th>
</tr>
<tr>
<td>1</td>
<td><input type="number" id="odd1" name="odd1" step="0.01" min="1.01" value="2.01"></td>
<td><input type="number" id="stake1" name="stake1" value="10.00"></td>
<td><span id="result1"></span></td>
</tr>
<tr>
<td>2</td>
<td><input type="number" id="odd2" name="odd2" step="0.01" min="1.01" value="2.01"></td>
<td><input type="number" id="stake2" name="stake2" value="10.00"></td>
<td><span id="result2"></span></td>
</tr>
<tr>
<td></td>
<td></td>
<td><input type="number" id="stake" name="total stake" value="100.00"></td>
<td></td>
</tr>
<tr>
<td>stake_step</td>
<td><input type="number" id="step" name="" step="0.1" value="0.1"></td>
<td></td>
<td></td>
</tr>
</table>
<script>
var stake = parseFloat(document.getElementById("stake").value)
var odd1 = parseFloat(document.getElementById("odd1").value)
var odd2 = parseFloat(document.getElementById("odd2").value)
var elStake1 = document.getElementById("stake1")
var elStake2 = document.getElementById("stake2")
console.log(stake, odd1, odd2)
console.log(typeof stake, typeof odd1, typeof odd2)
var spanResult1 = document.getElementById("result1")
var spanResult2 = document.getElementById("result2")
console.log(100/(2.01+2.01))
var unit = stake / (odd1 + odd2)
console.log(unit)
var stake1 = unit * odd2
var stake2 = unit * odd1
var result1 = stake1 * odd1
var result2 = stake2 * odd2
elStake1.value = stake1.toFixed(2)
elStake2.value = stake2.toFixed(2)
spanResult1.innerHTML = result1.toFixed(2)
spanResult2.innerHTML = result2.toFixed(2)
console.log(stake.value, odd1.value, odd2.value)
console.log(spanResult1, spanResult2)
</script>
</body>
</html>