SOURCE

console 命令行工具 X clear

                    
>
console
var   alldata   =   "0.88,1.88,2.88,6.88,9.88,50.0" //抽奖数据,以逗号分隔   
 var   alldataarr   =   alldata.split(",")   
  var   num   =   alldataarr.length-1   
  var   timer   
  function   change(){   
  document.getElementById("oknum").value   =   alldataarr[GetRnd(0,num)];   
  }   

  function   start(){   
  clearInterval(timer);   
  timer   =   setInterval('change()',50); //随机数据变换速度,越小变换的越快   
  }   
    
  function   ok(){   
  clearInterval(timer);   
  }   
    
  function   GetRnd(min,max){   
  return   parseInt(Math.random()*(max-min+1));   
  }   
<html>   
<title>随机抽奖</title>   
<head>
<meta http-equiv=Content-Type   content="text/html;   charset=utf-8">
</head>   
<body>
  <div style="width:300px; margin:150px  auto;  padding:20px;" >  
  <input   type="text"   id="oknum"   name="oknum"   value="" style="font-size:100px; height:120px; width:300px;text-align:center">
  <div style="margin:20px auto; width:300px">
  <button   onclick="start()" style="height:70px; width:140px; margin:20px; font-size:25px" >开始抽奖</button>     
  <button   onclick="ok()" style="height:70px; width:90px;font-size:25px; ">停止</button>   
  </div></div>
  </body>   
  </html>