-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathandroid_calc.html
143 lines (141 loc) · 3.68 KB
/
android_calc.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
<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<head>
<title>Real Calculator</title>
<style type="text/css">
body
{
background:linear-gradient(to right,#FF512F,#dd2476);
margin: 0px;
padding: 0px;
font-family: cursive;
font-size: 25px;
color:gray;
}
#C-container
{
margin:0 auto;
width: 360px;
height:630px;
background-color: #A7A8AA;
position: relative;
top: 20px;
left: 0px;
border-radius: 20px;
}
.textview
{
font-family: cursive;
font-size: 50px;
font-weight: bold;
color:gray;
border: none;
width: 100%;
height: 180px;
background-color: #FAFAFA;
border-radius: 20px 20px 0px 0px;
}
.button
{
cursor: pointer;
width: 90px;
height: 90px;
color: white;
text-align: center;
padding-top: 20px;
padding-bottom: 20px;
background-color:#1E2326;
font-family: cursive;
font-size: 25px;
margin: 0px;
border:none;
border-right: 1px solid #FAFAFA;
border-bottom: 1px solid #FAFAFA;
float: left;
}
#zero
{
border-radius: 0 0 0 20px;
border-bottom: none;
}
#equal
{
border-radius: 0 0 20px 0;
border-bottom: none;
border-right: none;
background-color: #FEC208;
}
.Rbutton
{
border-right: none;
background-color: #5E4BB6;
}
#del
{
border-bottom: none;
}
#dot
{
border-bottom: none;
}
#divide
{
font-size: 35px;
}
#clear
{
width: 180px;
}
</style>
</head>
<body>
<div id="C-container">
<form name="form">
<input class="textview" name="textview">
</form>
<input type="button" class="button" value="C" id="clear" onclick="erase()">
<input type="button" class="button" value="%" onclick="insert('%')">
<input type="button" class="button Rbutton" id="divide" value="÷" onclick="insert('/')">
<input type="button" class="button" value="7" onclick="insert(7)">
<button class="button" value="8" onclick="insert(8)">8</button>
<input type="button" class="button" value="9" onclick="insert(9)">
<input type="button" class="button Rbutton" id="multiply" value="*" onclick="insert('*')">
<input type="button" class="button" value="4" onclick="insert(4)">
<input type="button" class="button" value="5" onclick="insert(5)">
<input type="button" class="button" value="6" onclick="insert(6)">
<input type="button" class="button Rbutton" id="minus" value="-" onclick="insert('-')">
<input type="button" class="button" value="1" onclick="insert(1)">
<input type="button" class="button" value="2" onclick="insert(2)">
<input type="button" class="button" value="3" onclick="insert(3)">
<input type="button" class="button Rbutton" id="plus" value="+" onclick="insert('+')">
<input type="button" class="button" id="zero" value="0" onclick="insert(0)">
<input type="button" class="button" id="dot" value="." onclick="insert('.')">
<input type="button" class="button" id="del" value="del" onclick="back()">
<input type="button" class="button" id="equal" value="=" onclick="equal()">
</div>
<script type="text/javascript">
function insert(num){
document.form.textview.value=document.form.textview.value+num;
}
function equal(){
var exp=document.form.textview.value;
if(exp){
document.form.textview.value=eval(exp);
}
}
function erase(){
var exp=document.form.textview.value;
if(exp){
document.form.textview.value="";
}
}
function back(){
var exp=document.form.textview.value;
if(exp){
document.form.textview.value=exp.substring(0,exp.length-1);
}
}
</script>
</body>
</html>