-
Notifications
You must be signed in to change notification settings - Fork 0
/
javacalcu.html
121 lines (96 loc) · 2.93 KB
/
javacalcu.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
<!DOCTYPE html>
<html>
<head>
<title>javascript calculator</title>
</head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="styles/bootstrap.min.css" rel="stylesheet"></link>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="styles/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<style type="text/css">
body
{
background-image: linear-gradient(to left,#a3f99e,#e4f99e)
}
.row input
{
padding: 5px;
margin-left: 40px;
margin-right: 50px;
margin-top: 10px;
border-radius: 50px;
margin-top: 50px;
}
.row input:hover
{
width: 20%;
}
.btn
{
margin-right: 10px;
position: relative;
}
.btn:hover
{
background-color:#34e509;
border-radius: 40px;
}
.bo
{
border-radius: 30px;
}
.bo:hover
{
border-radius: 100px;
transition: 0.4s;
box-shadow: 2px 5px 2px 5px #6989f7;
}
.bo :hover
{
font-family: FreeMono, monospace
}
</style>
<body>
<div class="container mx-auto bo" style="border:1px solid black; text-align: center; width: 50%; margin-top: 100px; background-color: #81eef3;">
<div class="container-fluid mx-auto ">
<h2>Welcome to Javascript Calculator</h2>
</div>
<div class="container p-3">
<div class="row">
<input type="text" name="" id="n1" placeholder="input number 1">
<input type="text" name="" id="n2" placeholder="input number 2">
</div>
<div class="container p-3">
<input type="submit" name="" class="btn btn-primary" value="addition" onclick="add()">
<input type="submit" name="" class="btn btn-warning" value="subtract" onclick="subtract()">
<input type="submit" name="" class="btn btn-danger" value="multiply" onclick="multiply()">
<input type="submit" name="" class="btn btn-success" value="divide" onclick="divide()">
</div>
</div>
<script type="text/javascript">
function add(){
var a =document.getElementById('n1').value;
var b =document.getElementById('n2').value;
document.write(Number(a)+Number(b))
}
function subtract(){
var a =document.getElementById('n1').value;
var b =document.getElementById('n2').value;
document.write(Number(a)-Number(b))
}
function multiply(){
var a =document.getElementById('n1').value;
var b =document.getElementById('n2').value;
document.write(Number(a)*Number(b))
}
function divide(){
var a =document.getElementById('n1').value;
var b =document.getElementById('n2').value;
document.write(Number(a)%Number(b))
}
</script>
</div>
</body>
</html>