<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>体育彩票抽奖</title>
<script LANGUAGE="JavaScript"><!--
/*-----------------------------------------------------
应几个同事百般要求,为他们写了这个程序,况且我从不买彩票,也不懂.
不过你要是真的中了大奖,可别忘了告诉我老蒋哟,什么?怕我分你的钱?
我不贪财的,顶多送我张classic music碟我就很欢喜了!
by jianglixin@163.net (匆忙写就,代码零乱未及整理) 2001.2.28
-------------------------------------------------------*/
function SetCookie()
{
var Then = new Date() ;
if (document.all.luckNum.innerText.length>20)
{
Then.setTime(Then.getTime() + 1000*60*1000);
document.cookie = "LastNum="+document.all.luckNum.innerText+";expires="+ Then.toGMTString() ;
}
}
function GetCookie()
{
var cookieHeader = "LastNum=";
var beginPosition = document.cookie.indexOf(cookieHeader);
var status=document.cookie.substring(beginPosition + cookieHeader.length);
document.all.lastNum.innerText="上次为您选的数: "+status;
}
function check(form)
{
if(form.inputName.value.length<1)
{alert("请输入您的姓名!");
form.inputName.focus();
return(false);}
if(form.inputNum.value.length<1)
{alert("请输入您生日或幸运数字!");
form.inputNum.focus();
return(false);}
if(!(checknum(form.inputNum.value)))
{alert("幸运数必须是数字!");
form.inputNum.focus();
return(false);}
var randNum,seeds,repeat;
var my_array = new Array();
var test_array = new Array();
var sort_array = new Array();
seeds=form.inputNum.value;
selectNum=7;totalNum=36;
for (i=0;i<totalNum;i++) sort_array[i]=i;
for (i=0;i<totalNum;i++) test_array[i]=0;
for (p=0;p<seeds;p++)
{
var i = 0;
while (i <7)
{
repeat=false;
randNum=Math.ceil(totalNum*Math.random(seeds));
for (j=0;j<i;j++)
{
if (randNum==my_array[j])
repeat=true;
}
if (repeat==false)
{
my_array[i]=randNum;
test_array[randNum]+=1;
i++;
}
}
}
//my_array排序
var temp;
for (i=0;i<selectNum-1;i++)
{