Skip to content

Commit

Permalink
complete work of prim-bank
Browse files Browse the repository at this point in the history
  • Loading branch information
nasim354 committed Feb 6, 2024
1 parent cbce46c commit 86fc8fb
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 20 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ <h1 class ="color" >$ <span id="total">1200</span></h1>
<div class="col-md-6">
<div class="SignUp">
<h2 class="text-center">Deposit</h2> <br>
<input id="Amount" class="form-control" type="text" placeholder="$ Amount add deposit"> <br>
<input id="addAmount" class="form-control" type="text" placeholder="$ Amount add deposit"> <br>
<button id="addDeposit" class="btn btn-primary">Deposit</button>
</div>
</div>
Expand Down
45 changes: 27 additions & 18 deletions javaScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,39 @@
const nextItem = document.getElementById("Next-Area");
nextItem.style.display = "block";
})
// next healer
// Deposit handler.
const deposit = document.getElementById("addDeposit");
deposit.addEventListener("click", function(){
const amountA =document.getElementById("Amount").value;
const amountA =document.getElementById("addAmount").value;
const amountNumber = parseFloat(amountA);
const currentB = document.getElementById("current").innerText;
const currentNumber =parseFloat(currentB);
const totalNumber = amountNumber + currentNumber;
document.getElementById("current").innerText = totalNumber;
updateText("current",amountNumber)
updateText("total", amountNumber);


const total = document.getElementById("total").innerText;
document.getElementById("addAmount").value = "";

})
function updateText(id, amountNumber){
const total = document.getElementById(id).innerText;
const totalBalance = parseFloat(total);
const mainBalance = amountNumber + totalBalance;
document.getElementById("total").innerText = mainBalance ;
document.getElementById(id).innerText = mainBalance ;
}

document.getElementById("Amount").value = "";
//withdraw handler
const addWithdraw = document.getElementById("addWithdraw");
addWithdraw.addEventListener("click", function(){
const disNumber = document.getElementById("disAmount").value;
const disNumberBalance = parseFloat(disNumber);
updateText("current1", disNumberBalance);
updateText("total", -1* disNumberBalance);
document.getElementById("disAmount").value = "";
})

})
const addWithdraw = document.getElementById("addWithdraw");
addWithdraw.addEventListener("click",function(){
const disAmount = document.getElementById("disAmount").value;
const disBalance = parseFloat(disAmount);
const disValue = totalBalance - disBalance;
document.getElementById("disAmount").value = disValue;
function getInputNumber(id){
const disAmount = document.getElementById(id).value;
const disBalance = parseFloat(disAmount);
return disNumber;
}

document.getElementById("disAmount").value = "";
})

1 change: 0 additions & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ body{
margin-top: 50px;
box-shadow: 10px 10px 30px gray;
border-radius:10px;
/* background-color: rgba(243, 225, 194,.2); */

}
span{
Expand Down

0 comments on commit 86fc8fb

Please sign in to comment.