js 디지털 게임 의 간단 한 실현 코드 맞 추기


 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title> </title>
</head>
<body>
<input type="button" id="result" name="result" onclick="checknum()" value=" 、、、、、">
<script>
//
function GetRandomNum(Min,Max)

var Range = Max - Min; 
var Rand = Math.random(); 
return(Min + Math.round(Rand * Range)); 

//
function checknum(){
var num = GetRandomNum(1,100);
alert("dnhgn");
var i;
for(i=1;i<=10;i++){
var nums=prompt(" 1 100 , , 、、、、、","");
if(i==1){
 if(nums==num){
         alert(" , ");
   break;
     }else{
          if(nums<num){
       document.write(" " + i +" , <br>");
       }else{
    document.write(" " + i +" , <br>");
 }
}
}
if(i>1&&i<=10){
      if(nums==num){
         alert(" ");
   break;
      }else{
          if(nums<num){
       document.write(" " + i +" , <br>");
       }else{
    document.write(" " + i +" , <br>");
  }
}
}
if(i==10){
       if(nums!=num){
       document.write(" , !");
    return false;
       }
 }
}
}
</script>
</body>
</html>

좋은 웹페이지 즐겨찾기