另外妳再參考壹下我的32選7的彩票代碼 就應該會明白了!
<script>
var Number=new Array(6);
var Time;
var shu=10;
function RandomNum()
{
for(var i=0;i<Number.length;i++)
{
Number[i]=parseInt(Math.random()*32+1);
for(var n=0;n<i;n++){
if (Number[i] == Number[n])
{
Number[i]=parseInt(Math.random()*32+1);
}
}
}
var obj=document.getElementsByName("num");
for(var i=0;i<obj.length;i++)
{
obj[i].value=Number[i];
}
document.getElementById("num1").value=parseInt(Math.random()*16+1);
Time = setTimeout("RandomNum()",shu)
shu=shu+1;
if(shu>=50)
{
clearTimeout(Time);
document.getElementById("btnOK").value="買好離手啊"
shu=0;
}
}
</script>