File tree Expand file tree Collapse file tree 3 files changed +75
-0
lines changed Expand file tree Collapse file tree 3 files changed +75
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < 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
+ < link rel ="stylesheet " href ="style.css ">
8
+ < title > Loan Calculator</ title >
9
+ </ head >
10
+ < body >
11
+ < div class ="container ">
12
+ < h3 > Loan Calculator</ h3 >
13
+ < p > Loan Amount: < input type ="number " value ="1 " id ="amount " min ="0 " onchange ="calculateLoan() "> ₹</ p >
14
+ < p > Interest Rate: < input type ="number " value ="0.1 " id ="interest " min ="0 " onchange ="calculateLoan() "> % </ p >
15
+ < p > Months to Pay: < input type ="number " value ="1 " id ="months " min ="0 " onchange ="calculateLoan() "> </ p >
16
+
17
+ < h2 id ="payment "> </ h2 >
18
+ </ div >
19
+ < script src ="script.js "> </ script >
20
+ </ body >
21
+ </ html >
Original file line number Diff line number Diff line change
1
+
2
+ function calculateLoan ( ) {
3
+ const amount = document . querySelector ( "#amount" ) . value ;
4
+ const interestRate = document . querySelector ( "#interest" ) . value ;
5
+ const months = document . querySelector ( "#months" ) . value ;
6
+
7
+ const interest = ( amount * ( interestRate * 0.01 ) ) / months ;
8
+ const payment = ( ( amount / months ) + interest ) . toFixed ( 2 ) ;
9
+
10
+ document . querySelector ( "#payment" ) . innerHTML = `EMI: ₹ ${ payment } `
11
+
12
+ }
Original file line number Diff line number Diff line change
1
+ body {
2
+ background-color : pink;
3
+ }
4
+
5
+ .container {
6
+ width : 400px ;
7
+ height : 450px ;
8
+ background-color : # ff1d58 ;
9
+ position : absolute;
10
+ top : 50% ;
11
+ left : 50% ;
12
+ transform : translateX (-50% ) translateY (-50% );
13
+ color : white;
14
+ padding : 20px 0 0 100px ;
15
+ border-radius : 50px ;
16
+ }
17
+
18
+ h3 {
19
+ font-size : 35px ;
20
+ }
21
+
22
+ input {
23
+ width : 80% ;
24
+ padding : 8px ;
25
+ border : none;
26
+ margin-top : 10px ;
27
+ }
28
+
29
+ input : focus {
30
+ outline : none;
31
+ }
32
+
33
+ h2 {
34
+ margin-top : 30px ;
35
+ }
36
+
37
+ @media screen and (max-width : 360px ){
38
+ .container {
39
+ border-radius : 0 ;
40
+ top : 37% ;
41
+ }
42
+ }
You can’t perform that action at this time.
0 commit comments