example03.html 685 B

12345678910111213141516171819202122232425262728293031
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title></title>
  6. </head>
  7. <body>
  8. <script>
  9. do {
  10. var answer = parseInt(Math.random() * 100 + 1);
  11. var total = 0;
  12. do {
  13. total += 1;
  14. var thyAnswer = parseInt(prompt("请输入:"));
  15. if (thyAnswer > answer) {
  16. alert("小一点");
  17. } else if (thyAnswer < answer) {
  18. alert("大一点");
  19. } else if (thyAnswer == answer) {
  20. alert("恭喜你猜对了");
  21. } else {
  22. alert("你是猴子派来的逗比吗?");
  23. }
  24. } while (thyAnswer != answer);
  25. if (total > 7) {
  26. alert("智商捉急!!!");
  27. }
  28. } while (confirm('再来一局?'));
  29. </script>
  30. </body>
  31. </html>