<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<script>
var money = 100;
do {
var select = prompt('请输入您要的操作:\n1.存钱\n2.取钱\n3.显示余额\n4.退出');
switch (parseInt(select)) {
case 1:
var money1 = prompt('请输入你要存的金额:');
money += parseFloat(money1);
alert('成功存入' + money1 + '元');
break;
case 2:
var money2 = prompt('请输入你要取的金额:');
money -= money2;
alert('成功取出' + money2 + '元');
break;
case 3:
alert('当前余额:' + money + '元');
break;
case 4:
alert('成功退出');
break;
}
} while (select != 4)
</script>
<body>
</body>
</html>
实现了:1.存钱 2.取钱 3.显示余额 4.退出 功能