<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>
<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实现的简易网页抽奖程序。该程序通过按钮触发,能够随机显示预设的名单中的名字,并可通过另一按钮停止滚动。页面背景及字体样式已设定。
538

被折叠的 条评论
为什么被折叠?



