js实现随机数抽奖
;;;;;;;;;;;;;;源码::::::::::
<!DOCTYPE html>
<html lang="zh"><head>
<title>幸运抽奖</title>
<script type="text/javascript">
var randNum=Math.random()*100;
function testTime(){
document.getElementById("testtime").innerHTML="<h2>"+Math.floor(Math.random()*100)+"</h2>";
}
function setTime(mark){
timer=null;
timer=setInterval(testTime,60);
if(mark=='stop'){
clearInterval(timer);
}
return timer;
}
function clearTime(timer){ }
</script>
<style type="text/css">
<!--
body {font-family: Arial;color:rgb(91, 100, 230);margin: 0px;padding: 50px;background:rgb(245, 201, 209);text-align:center;}
#happyness{font-size:186px;line-height:186px;margin-top:100px;}
-->
</style>
</head>
<body>
</body>
<button onClick="timer=setInterval(testTime,60);" value="" style="width:100px;height:30px">开始</button>
<button onClick="clearInterval(timer);" value="Stop" style="width:100px;height:30px">停止</button>
<div id="testtime" style="font-size:180px"></div>
<br>
</html>
:::::::::::::::::效果::::::::::::::::::::::::