⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 java.txt

📁 产生随机数实现摇号功能的java源码
💻 TXT
字号:
   1. <script>  
   2. var theTimer;  
   3. var iNum=0;  
   4. //var flag =true;  
   5. function checkEnter(){  
   6.     if(window.event.keyCode==13){  
   7.         document.getElementById("btnStop").focus();  
   8.         flag=true;  
   9.         if(flag){  
  10.             clearTimeout(theTimer);  
  11.             flag = false;  
  12.         }else{  
  13.             theTimer = setTimeout("checkLoad()", 8);  
  14.             flag=true;  
  15.         }  
  16.         //document.getElementById("btnStop").click();       onkeypress="checkEnter();"  
  17.     }  
  18. }  
  19.       
  20. function checkLoad() {  
  21.     iNum=selectFrom(1,200);  
  22.     if(iNum<10){  
  23.     document.getElementById("stext").innerHTML="00"+iNum;  
  24.     }else if(iNum<100){  
  25.     document.getElementById("stext").innerHTML="0"+iNum;  
  26.     }else{  
  27.     document.getElementById("stext").innerHTML=iNum;  
  28.     }  
  29.     theTimer = setTimeout("checkLoad()", 8);  
  30. }  
  31. function selectFrom(iFirstValue,iLastValue){  
  32.     var iChoices =  iLastValue-iFirstValue+1;  
  33.     return Math.floor(Math.random()*iChoices+iFirstValue);  
  34. }  
  35.   
  36. function stopPlay() {  
  37.     clearTimeout(theTimer);   
  38. }  
  39. function resetText(){  
  40.     stopPlay();   
  41.     document.getElementById("hisRecord").innerText=document.getElementById("hisRecord").innerText+document.getElementById("stext").innerHTML+",";  
  42.     document.getElementById("stext").innerHTML="000";  
  43. }  
  44.   
  45. </script>  
  46. <body onkeypress="checkEnter();">  
  47. <table width="100%">  
  48. <tr height="300">  
  49. <td align="center">  
  50. <div id="stext" style="font-size:146px;color:red;bold" align="center">000</div>  
  51. </td>  
  52. </tr>  
  53. <tr height=""><td>  
  54. <div align="center">  
  55.           
  56. <input type="button" value="开始" onClick="checkLoad()" style="height:60;width:130"/>  
  57.       
  58. <input id="btnStop" type="button" value="停止" onClick="stopPlay();" style="height:60;width:130"/>  
  59.       
  60. <input type="button" value="重置" onClick="resetText();"/>  
  61. </div>  
  62. </td>  
  63. </tr>  
  64. <tr>  
  65. <td align="center"><br />  
  66. 历史记录:<table width="400"><tr ><td><textarea id="hisRecord" style="width:500;height:100"></textarea></td></tr></table>  
  67. </td>  
  68. </tr>  
  69. </table>  
  70.   
  71. </body>  
  72. </html>  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -