<!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>Title</title>
<script>
function random(min, max) {
return b = Math.floor(Math.random() * (max - min + 1)) + min;
}
var b = random(0, 10)
while (true) { //死循环
var a = prompt('请输入一个数')
if (a > b) {
alert('你猜大了')
} else if (a < b) {
alert('你猜小了')
} else {
alert('你猜对了')
break; //退出整个循环,防止死循环
}
}
</script>
</head>
<body>
<div>
</div>
</body>
</html>
黑马js抽奖游戏
最新推荐文章于 2024-09-06 23:41:09 发布