2006-12-05

用Javascript轻松制作抽奖系统

来源: 本站收集整理 作者:佚名 评论 0 条
 
timer = setInterval("getRandNum();",10);
document.getElementById("start").disabled = true;
document.getElementById("end").disabled = false;
}
function clearTimer(){
noDupNum();
clearInterval(timer);
document.getElementById("start").disabled = false;
document.getElementById("end").disabled = true;

}

function noDupNum(){
// to remove the selected mobile phone number
mobile.removeEleAt(randnum);

// to reorganize the mobile number array!!
var o = 0;
for(p=0; p<mobile.length;p ){
if(typeof mobile[p]!="undefined"){
mobile[o] = mobile[p];
o ;
}
}
num = mobile.length-1;
}
// method to remove the element in the array
Array.prototype.removeEleAt = function(dx)
{
if(isNaN(dx)||dx>this.length){return false;}
this.splice(dx,1);
}
// set mobile phone numbers to the table cell
function setValues(){
document.getElementById(cellnum).value = document.getElementById("result").value ;
cellnum ;
}
</script>
</head>
<body>
<center>
<div> </div>
<div id="main">
<div>
<h1>中奖号码</h1>

<p>
<input id="result" type="text" size="30" style="height:130px;width:800px;border:2px solid red;font-size:120;" readonly/></p>
<p>
<input id="start" type="button" value="开始" style="border: 1px solid; border-color: #aaa 000 #000 #aaa;width:4em; background: #fc0;" onclick="setTimer()" />
<input id="end" type="button" value="停" style="border: 1px solid; border-color: #aaa 000 #000 #aaa;width:4em; background: #fc0;"onclick="clearTimer();setValues();" disabled/>
</p>
<p><strong>一等奖(10名)</strong></p>
<table width="946" height="79" border="1">
<tr>
<td><input name="text36" type="text" id="36" style="height:30px;width:190px;border:1px solid red;font-size:25;" size="28" readonly/></td>
<td><input name="text37" type="text" id="37" style="height:30px;width:190px;border:1px solid red;font-size:25;" size="20" readonly/></td>
<td><input name="text38" type="text" id="38" style="height:30px;width:190px;border:1px solid red;font-size:25;" size="20" readonly/></td>
<td><input name="text39" type="text" id="39" style="height:30px;width:190px;border:1px solid red;font-size:25;" size="20" readonly/></td>
共5页: 上一页 [1] 2 [3] [4] [5] 下一页

(本文仅表明作者个人观点,不代表本站及其管理员立场.) 推荐 收藏 投稿 打印 返回 关闭
上一篇:经典:两段不错的JS特效!  
下一篇:HTML的历史
    评论加载中…

网站首页  -  网站地图 -   站长论坛  -  网站投稿  -    -  网站管理
Copyright © 2008 芜湖站长站 All Rights Reserved 皖ICP备07500611号