JavaScript中简单的--抽奖写法

<title>无标题文档</title>
<script>
var t;
function f(){
var li=["张三","李四","王五","赵武","孙子","周把"];
var i=Math.ceil(Math.random()*(li.length-1));
document.getElementById("cj").innerHTML=li[i];
t=setTimeout(f,100);
}
function ff(){
clearTimeout(t);
}
</script>
</head>


<body background="1502182214614.jpg">
<span id="cj" style="font-size:300px; color:#FF0000;"></span>
<br /><br />
<input type="button" value="抽奖" onclick="f()" />
<input type="button" value="停止" onclick="ff()" />
</body>JavaScript中简单的--抽奖写法