<script> <br>//Get random number<br>function GetRandomNum(Min,Max)<br>{ <br>var Range = Max - Min; <br>var Rand = Math.random(); <br>return(Min Math.round(Rand * Range)); <br>} <br>//Get the text box content<br>function checknum() {<br>var num = GetRandomNum(1,100);<br>alert("dnhgn");<br>var i;<br>for(i=1;i<=10;i ){<BR>var nums =prompt("Guess the number between 1 and 100, you only have ten chances, come on,,,,,","");<BR>if(i==1){<BR> if (nums==num){<BR> alert("Congratulations on the correct answer, you are so smart");<BR> break;<BR> }else{<BR> if(nums<num){<BR> document. write("You have entered for the "i"th time, and the number is a bit too small<br>");<br> }else{<br> document.write("You have entered for the "i"th time, the number is a bit too small Big<br>");<br> }<br>}<br>}<br>if(i>1&&i<=10){<br> if(nums==num){<br> alert( "Congratulations to the answer"); <br> Break; <br>} else {<br> if (nums & lt; num) {<br> document.write ("You are already" i "secondary input, the number is a bit smaller <br>");<br> }else{<br> } document.write("You have entered for the " i "th time, the number is a bit too big<br>");<br> }<br>} <br>}<br>if(i==10){<br> if(nums!=num){<br> document.write("You have no chance, what a pity! ");<br> return false;<br> }<br> }<br>}<br>}<br></script>
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn