第十二次作业

这个作业属于哪个课程 https://edu.cnblogs.com/campus/sdscfz/SF4
这个作业要求在哪里 https://edu.cnblogs.com/campus/sdscfz/SF4/homework/12964
这个作业的目标 第十二次作业
<!DOCTYPE html>
<html>
<head>
    <title>猜字游戏</title>
	<script>
		window.onload = function() {
			var a = Math.floor(Math.random() * 10) + 1;
			var b = 0;
			
			while (b !== a) {
				b = prompt("猜一个在1~10之间的整数");
				b = parseInt(b);
				
				if (b < a) {
					alert("猜小了");
				} else if (b > a) {
					alert("猜大了");
				} else {
					alert("猜中了!");
				}
			}
		};
	</script>
</head>
<body>
</body>
</html>




posted @ 2023-05-25 22:59  刘浩龙  阅读(3)  评论(0编辑  收藏  举报