A-A+

手机号码抽奖 (JS)

2015年10月10日 前端 暂无评论 阅读 1,934 次
守财鹿邀请码

三等奖开始抽取,填满三等奖,填二等奖,之后填1等奖,源码完整,可以改!

 

<!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=utf-8" />
<title>手机号码抽奖</title>

<style type="text/css">
<!-- .STYLE1 { color: #FF0000; font-size:30px; font-weight:bold; } #result{ width:380px; height:80px; font-size:54px; color:#F00; line-height:50px; text-align:center;} #start{ width:180px; height:60px;} #end{ width:180px; height:60px;} .imobile{ margin:30px auto; background:#eee; width:1000px; border:#ccc solid 1px; height:400px;} .imobile span{ float:left; margin-left:25px; font-size:24px; line-height:40px} .itextall{ width:180px; height:30px; line-height:30px; text-align:center; font-size:24px;} body{ background-color: #E4E4E4; margin-top: 20px; } .icjq{ position:relative;} .center{ margin:0 auto; width:1000px; } .ift{ position:absolute; width:370px; height:65px; background:#f00; bottom:0px; left:315px;background-color: rgba(0,0,0,0.6)} .itishi{position:absolute; width:370px; height:65px; bottom:0px; left:315px; font-size:30px; line-height:60px; color:#fff;} .idiv{ width:100%; display:none;} -->
</style>

</head>
<body>

<div align="center" class="icjq center" >
<span class="STYLE1">手机号码抽奖</span>

(先抽的是三等奖 最后才是一等奖)

<input name="text" type="text" id="result" class="itextall" size="15" readonly />

<input type="button" id="start" onClick="setTimer()" value="开始" />
<input type="button" disabled id="end" onClick="clearTimer();" value="停 止"/>

<div class="idiv" id="idiv">

<div class="ift"></div>


<div class="itishi">抽奖已经全部结束!</div>

</div>

</div>



<div align="center" class="center"><strong><span class="STYLE1">特等奖</span></strong><1名></div>


<table border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#F2F2F2">

<tr>

<td><input name="text11" type="text" id="11" class="itextall" size="15" readonly/></td>

</tr>

</table>



<div align="center" class="center"><strong><span class="STYLE1">一等奖</span></strong><2名></div>


<table border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#F2F2F2">

<tr>

<td><input name="text9" type="text" id="9" class="itextall" size="15" readonly/></td>


<td><input name="text10" type="text" id="10" class="itextall" size="15" readonly/></td>

</tr>

</table>



<div align="center" class="center"><span class="STYLE1"><strong>二等奖</strong></span><3名></div>


<table border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#F2F2F2">

<tr>

<td><input name="text6" type="text" id="6" class="itextall" size="15" readonly/></td>


<td><input name="text7" type="text" id="7" class="itextall" size="15" readonly/></td>


<td><input name="text8" type="text" id="8" class="itextall" size="15" readonly/></td>

</tr>

</table>



<div align="center" class="center"><span class="STYLE1"><strong>三等奖</strong></span><5名></div>


<table border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#F2F2F2">

<tr>

<td><input name="text1" type="text" id="1" class="itextall" size="15" readonly/></td>


<td><input name="text2" type="text" id="2" class="itextall" size="15" readonly/></td>


<td><input name="text3" type="text" id="3" class="itextall" size="15" readonly/></td>


<td><input name="text4" type="text" id="4" class="itextall" size="15" readonly/></td>


<td><input name="text5" type="text" id="5" class="itextall" size="15" readonly/></td>

</tr>

</table>

<!--
<div class="imobile" id="imobile"></div>

-->
<script language="javascript">
            <!--
            // 全局变量
            var timer;
            var flag = new Array(100);
            var existingnum = new Array(100);
            var clickTimes = 0;
            var randnum;
            var cellnum = 1;
			var ijs=0; 
            var mobile = new Array();
            //在这里设置数据!!
            mobile[0] = 13020000100;
            mobile[1] = 13020000101;
            mobile[2] = 13020000102;
            mobile[3] = 13020000103;
            mobile[4] = 13020000104;
            mobile[5] = 13020000105;
            mobile[6] = 13020000106;
            mobile[7] = 13020000107;
            mobile[8] = 13020000108;
            mobile[9] = 13020000109;
            mobile[10] = 13020000110;
            mobile[11] = 13020000111;
            mobile[12] = 13020000112;
            mobile[13] = 13020000113;
            mobile[14] = 13020000114;
            mobile[15] = 13020000115;
            mobile[16] = 13020000116;
            mobile[17] = 13020000117;
            mobile[18] = 13020000118;
            mobile[19] = 13020000119;
            mobile[20] = 13020000120;
            mobile[21] = 13020000121;
            mobile[22] = 13020000122;
            mobile[23] = 13020000123;
            mobile[24] = 13020000124;
            mobile[25] = 13020000125;
            mobile[26] = 13020000126;
            mobile[27] = 13020000127;
            mobile[28] = 13020000128;
            mobile[29] = 13020000129;
            mobile[30] = 13020000130;
            mobile[31] = 13020000131;
            mobile[32] = 13020000132;
            mobile[33] = 13020000133;
            mobile[34] = 13020000134;
            mobile[35] = 13020000135;
            mobile[36] = 13020000136;
            mobile[37] = 13020000137;
            mobile[38] = 13020000138;
            mobile[39] = 13020000139;
            mobile[40] = 13020000140;
            mobile[41] = 13020000141;
            mobile[42] = 13020000142;
            mobile[43] = 13020000143;
            mobile[44] = 13020000144;
            mobile[45] = 13020000145;
            mobile[46] = 13020020146;
            var num = mobile.length - 1;
            function getRandNum()
			  {
                num = parseInt(num);
                var y = GetRnd(0, num);
					document.getElementById("result").value = mobile[y];
              }
            function GetRnd(m, n) {
                randnum = parseInt(Math.random() * (n - m + 1));
                return randnum;
            }
            function setTimer() {
                time = setInterval("getRandNum()", 10);
                document.getElementById("start").disabled = true;
                document.getElementById("end").disabled = false;
            }
            function clearTimer() {
                clearInterval(time);
                document.getElementById("start").disabled = false;
                document.getElementById("end").disabled = true;	
	           // document.getElementById("result").value = mobile[ijs]; //作弊行为
			      ijs++;
				  if(ijs ==11)
				  {
					 document.getElementById("idiv").style.display="block";
					  
					  }
                setValues();
               }
				// 将手机号码设置为表单元格
				function setValues() {
					document.getElementById(cellnum).value = document.getElementById("result").value;
					cellnum++;
				}
/*			 var inumstr="";
			for(var inum=0; inum<= mobile.length-1; inum++)
			   {
				 inumstr=inumstr+"<span>"+mobile[inum]+"</span>";
				}
		 document.getElementById("imobile").innerHTML = inumstr;*/
        </script>
</body>
</html>

抽奖实例

打赏

给我留言

Copyright © WEB小工匠 保留所有权利.   渝ICP备15008469号

渝公网安备 50023602000173号

用户登录

分享到: