老师帮我看看对不对,谢谢
来源:4-9 编程练习
KhadaJhin
2018-01-11 12:51:28
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Math.random()</title>
</head>
<body>
<script>
var input=prompt("请输入你猜的数字");
function fun(input){
var num1=Math.floor(Math.random()*9+1);
while(input!=num1){
if(input<num1){
alert("你输入的数字太小了");
input=prompt("请再次输入你猜的数字")
}
else{alert("你猜的数字太大了");
input=prompt("请再次输入你猜的数字")
}
}
if(num1=input){
alert("你猜对了");
}
}
fun(input)
</script>
</body>
</html>
2回答
你好,实现的效果是没有问题的,另:@“九万”同学的问题如果无法解决,可以把代码粘贴出来哦,便于大家一起测试与解决问题。
祝学习愉快~
力万
2018-01-11
看了半天发现我自己的是错的!我的那个猜错窗口弹出没弄出来。- -!
相似问题