Formula for calculating interest: interest = principal * interest rate/coupon * (expiry date-start date)
But every time you have to calculate a very troublesome, rather develop a small thing, direct input can draw interest, with a little time to do, although simple, or want to dedicate to everyone ~
--index.html--
<! DOCTYPE html>
<title> Interest Calculation </title>
<meta http-equiv= "Content-type" content= "Text/html;charset=utf-8"/>
<script type= "Text/javascript" src= "Jquery-3.2.1.min.js" ></script>
<script type= "Text/javascript" >
$ (document). Ready (function () {
$ ("#btn"). Click (function () {
var benjin=$ ("#benjin"). Val ();
var lilv=$ ("#lilv"). Val ();
var jixi=$ ("#jixi"). Val ();
var day1=$ ("#day1"). Val ();
var day2=$ ("#day2"). Val ();
var startdate=new Date (Day1);
var enddate=new Date (day2);
var time=enddate.gettime ()-startdate.gettime ();
var day=parseint (time/(1000 * 60 * 60 * 24));
var num=benjin* (lilv/100)/jixi*day;
Alert ("Interest:" +number (num). toFixed (2));
});
});
</script>
<body>
<p> Principal: <input type= "text" id= "Benjin"/></p>
<p> interest Rate: <input type= "text" id= "Lilv"/>%</p>
<p> interest Base: <select id= "Jixi" >
<option>365</option>
<option>360</option>
</select></p>
<p> Interest Date: <input type= "date" id= "Day1"/></p>
<p> expiry date: <input type= "date" id= "Day2"/></p>
<input type= "button" value= "calculation" id= "BTN" >
</body>
Only need to introduce the jquery library to the ~
Html+jquery Simple Interest Calculator