✔ 最佳答案
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>random_chooser</title>
<script>
var i;
var counter=0;
var real_value;
slotitem = new Array('David','Mary','Leon','Martin','Ada','Sunny','Jacky','Paul','Peter','Sam');
//這個是基於javascript的網頁,只要將所有code copy去記事本之後另貯新檔在文件類型那行選所有檔案,用法如下只要將上訪的人名轉做自己想要的,如果想增加人名照格式加就可以,如果你想用中文名要在head行邊那行的charset=gb2312轉做Big5,不過最保障做法是用中文名.//
function spinem1() {
turns1=Math.floor(Math.random()* slotitem.length);
real_value=slotitem[turns1];
for(i=0;i<turns1;i++)
{
document.slots.slot1.value="the element no is "+slotitem[turns1]
document.forms[0].mybutton.disabled=true;
}
counter++;
if(counter<25)
{
setTimeout("spinem1();",40);
}
else
{
counter = 0;
i=0;
document.slots.slot1.value="the element no is "+real_value;
slotitem.splice(turns1,1);
document.forms[0].mybutton.disabled=false;
if(slotitem.length<=0)
{
alert("no more element");
}
}
}
</script>
</head>
<body>
<form name=slots>
<input type="text" name=slot1 size=40><br>
<input type="button" name="mybutton" value="spin" onclick="spinem1()">
</form>
</body>
</html>