<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script>
var count = 100;
var num = prompt('请输入您要的操作:\n 1、存钱\n 2、取钱\n 3、显示余额\n 4、退出');
switch (parseInt(num)) {
case 1:
var a = prompt('请输入存钱的数目');
count += parseInt(a);
alert('你卡中余额为' + count);
break;
case 2:
var b = prompt('请输入取钱的数目');
count -= parseInt(b);
alert('你卡中余额为' + count);
break;
case 3:
alert('你卡中余额为' + count);
break;
case 4:
break;
default:
alert('请按要求输入');
}
</script>
</head>
<body>
</body>
</html>
JS--简易ATM
最新推荐文章于 2022-08-02 10:50:03 发布