首页 » 技术分享 » 抽签网页板代码

抽签网页板代码

 

<!doctype html>
<HTML>
<HEAD>
<meta charset="utf-8">
<style type="text/css">
body{
font-size:100px;
text-align:center;
}
input{
width:350px;
height:140px;
font-size:80px;
}
</style>
<TITLE>抽签网页版</TITLE>
<SCRIPT LANGUAGE="JavaScript">
var names = [
"01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22"
];

var name;
var index = -1;
var time;
function begin(){
document.getElementById("btnBegin").disabled = true;
chouqian();
}
function chouqian(){
if(names.length > 0){
index = Math.floor(Math.random()*1000 % names.length);
name = names[index];
document.getElementById("result").innerHTML = name;

time = window.setTimeout(chouqian,2);
}else{
document.getElementById("result").innerHTML = "~结束~";
}
}
function end(){
window.clearTimeout(time);
document.getElementById("btnBegin").disabled = false;
names.splice(index, 1);
}
</SCRIPT>
</HEAD>

<BODY>

<div>
<h3>抽签顺序</h3>
<h1 id="result" style="color:blue;">^_^</h1>
<INPUT TYPE="button" VALUE="开始" id="btnBegin" ONCLICK="begin();">
<INPUT TYPE="button" VALUE="结束" id="btnEnd" ONCLICK="end();">
</div>
</BODY>
</HTML>

转载自原文链接, 如需删除请联系管理员。

原文链接:抽签网页板代码,转载请注明来源!

0