-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathindex.html
64 lines (50 loc) · 1.71 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
<!DOCTYPE html>
<html>
<head>
<title>Worlds Best Calculator</title>
<!-- CSS only -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<style>
</style>
<script>
var calculator = {
addNumbers: function () {
// hint: these are strings
var numberOne = document.forms.inputs.numberOne.value;
var numberTwo = document.forms.inputs.numberTwo.value;
document.forms.inputs.result.value = numberOne + numberTwo;
},
subtractNumbers: function () {
}
}
</script>
</head>
<body>
<div>Header</div>
<div>
<!--
- allow two numbers to be entered
- show buttons for add and subtract
- show the result
-->
<form name="inputs">
<div>
Number 1:
<input type="number" name="numberOne" class="form-control" placeholder="First number" aria-label="Number1" >
</div>
<div>
Number 2:
<input type="number" class="form-control" name="numberTwo">
</div>
<div>
<button type="button" class="btn btn-primary" onclick="calculator.addNumbers()" >Add</button>
<button type="button" class="btn btn-primary">Substract</button>
</div>
<div>
<input name="result" value="0" class="form-control" disabled />
</div>
</form>
</div>
<div>Footer</div>
</body>
</html>