<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>随机抽奖</title>
</head>
<body><div id="thing">奖品</div><button id="check">开始抽奖</button><script>thing=document.getElementById('thing')check=document.getElementById('check')check.onclick=checkinvar things=['谢谢惠顾','再来一次','10元','20元','30元','40元','50元']function gennum() {a=Math.floor(Math.random()*10)return a%7}function checkout(){flag=falsecheck.innerHTML='停止抽奖'check.onclick=checkinchange=setInterval(function() {thing.innerHTML=things[gennum()]},100)}function checkin() {flag=truecheck.innerHTML='开始抽奖'check.onclick=checkoutclearInterval(change)}</script></body>
</html>
点击开始抽奖 奖品将会随机变换
点击停止抽奖 奖品定住