企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
``` <!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="utf-8"> </head> <body> <center> <div id="box" style="width: 100px;height:100px;outline: 1px solid red;">点击开始抽奖</div> <button>开始</button> <button>停止</button> </center> <script type="text/javascript"> var box=document.getElementById("box"); var button=document.getElementsByTagName("button"); var arr=["特等奖","一等奖",'二等奖',"三等奖"]; var time=null; button[0].onclick=function(){ if (time==null) { time=setInterval(function(){ var i=Math.ceil(Math.random()*10000)%arr.length; box.innerHTML=arr[i] },10) } } button[1].onclick=function(){ clearInterval(time); time=null; } </script> </body> </html> ```