1
- <!DOCTYPE html>
2
- < html lang ="en ">
1
+ < html >
3
2
< head >
4
- < meta charset ="UTF-8 ">
5
- < meta http-equiv ="X-UA-Compatible " content ="IE=edge ">
6
- < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
7
- < title > Basic Calculator</ title >
8
- < link rel ="stylesheet " href ="style.css ">
3
+ < link rel ="stylesheet " type ="text/css " href ="style.css ">
4
+ < body style ="background-color:powderblue; "> </ body >
9
5
</ head >
10
6
< body >
7
+ < h1 > Calculator</ h1 >
11
8
< div class ="calculator ">
12
- < input type ="text " id ="result " readonly >
9
+ < input type ="text " id ="display " readonly >
13
10
< div class ="buttons ">
14
- < button class =" clear "> C</ button >
15
- < button class =" operator " > / </ button >
16
- < button class =" operator " > * </ button >
17
- < button class =" operator " > - </ button >
18
- < button class =" number " > 7 </ button >
19
- < button class =" number " > 8 </ button >
20
- < button class =" number " > 9 </ button >
21
- < button class =" operator " > + </ button >
22
- < button class =" number " > 4 </ button >
23
- < button class =" number " > 5 </ button >
24
- < button class =" number " > 6 </ button >
25
- < button class =" equals " > = </ button >
26
- < button class =" number " > 1 </ button >
27
- < button class =" number " > 2 </ button >
28
- < button class =" number " > 3 </ button >
29
- < button class =" number " > 0 </ button >
30
- < button class =" decimal " > . </ button >
11
+ < button onclick =" clearDisplay() "> C</ button >
12
+ < button onclick =" appendToDisplay('7') " > 7 </ button >
13
+ < button onclick =" appendToDisplay('8') " > 8 </ button >
14
+ < button onclick =" appendToDisplay('9') " > 9 </ button >
15
+ < button onclick =" appendToDisplay('+') " > + </ button >
16
+ < button onclick =" appendToDisplay('4') " > 4 </ button >
17
+ < button onclick =" appendToDisplay('5') " > 5 </ button >
18
+ < button onclick =" appendToDisplay('6') " > 6 </ button >
19
+ < button onclick =" appendToDisplay('-') " > - </ button >
20
+ < button onclick =" appendToDisplay('1') " > 1 </ button >
21
+ < button onclick =" appendToDisplay('2') " > 2 </ button >
22
+ < button onclick =" appendToDisplay('3') " > 3 </ button >
23
+ < button onclick =" appendToDisplay('*') " > * </ button >
24
+ < button onclick =" appendToDisplay('0') " > 0 </ button >
25
+ < button onclick =" appendToDisplay('.') " > . </ button >
26
+ < button onclick =" calculateResult() " > = </ button >
27
+ < button onclick =" appendToDisplay('/') " > / </ button >
31
28
</ div >
32
29
</ div >
33
- < script src ="index .js "> </ script >
30
+ < script src ="script .js "> </ script >
34
31
</ body >
35
32
</ html >
0 commit comments