运行代码 缩小
汉王
HTML代码
复制 格式化 注释 注释 清空
放大
AخA
 
1
<!DOCTYPE html>
2
<html lang="zh">
3
<head>
4
<title>抽奖程序</title>
5
<script type="text/javascript"> 
6
var randNum=Math.random()*10;
7
function testTime(){
8
document.getElementById("testtime").innerHTML="<h2>"+Math.floor(Math.random()*10)+"</h2>";
9
}
10
    
11
function setTime(mark){
12
timer=null;
13
timer=setInterval(testTime,12);
14
if(mark=='stop'){
15
    clearInterval(timer);
16
}
17
return timer;
18
}
19
function clearTime(timer){ }
20
</script>
21
<style type="text/css">
22
<!--
23
body {font-family: Arial;color:#fff;margin: 0px;padding: 0px;background:#000;text-align:center;}
24
#happyness{font-size:186px;line-height:186px;margin-top:100px;}
25
-->
26
</style>
27
</head>
28
<body>
29
</body>
30
<button onClick="timer=setInterval(testTime,12);" value="" style="width:100px;height:30px">开始抽奖</button>
31
<button onClick="clearInterval(timer);" value="Stop" style="width:100px;height:30px">停止</button>
32
<div id="testtime" style="font-size:25px"></div>
33
</html>
CSS代码
复制 格式化 注释 注释 颜色 清空
放大
CSS代码...
x
 
1
JS代码
复制 格式化 注释 注释 清空
放大
JS代码...
xxxxxxxxxx
1
 
1
名称
网页抽奖JS小程序
分类
网站常用
描述
网页抽奖程序,基于javascript代码实现,简单的演示如何使用JS来实现抽奖功能,点击“开始抽奖”按钮,程序即开始抽奖了,需要停止的时候按“停止”,以前发过类似的抽奖程序有几个了,有兴趣的自己在本站网页特效栏目搜索“抽奖”看下。
收藏