Code Please Help

admin

Administrator
Staff member
Can somone help me. I am a newbie. I need this code to remember the balance and also it will not add it just puts the numbers next to each other please help.

<html>
<body>
<script type="text/javascript">
var choice
var balance = 0
var temp = balance
while (choice!="x") {

var choice =(prompt("Enter D to Deposit W to Withdraw B For Balance X to Exit: ",""))

if (choice=="d")

{

var amount =(prompt("Enter the Deposit Amount: ",""))

document.write("<p>The balance after deposit is:",temp+amount)

}

else if (choice=="w")

{

var amount =(prompt("Enter the amount to withdraw: ",""))

document.write("<p>The balance after withdrawing is:",temp-amount)

}

else if (choice=="b")

{

document.write("<p>Your Balanance is:",temp)
}
}
document.write("<P>Thank You Please Come Again!")

</script>
</body>
</html>
 
Back
Top