html 抽奖代码

<!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>
    <title>抽奖</title>
    <meta http-equiv="Content-Type" content="text/html;
charset=gb2312">
    <script language="javascript">
    <!--
    // global variables
    var timer;
    var flag = new Array(100);
    var existingnum = new Array(100);
    var clickTimes = 0;
    var randnum;
    var cellnum = 1;
    var mobile = new Array();
    // set data here!!
    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 start() {
        clearInterval(timer);
        timer = setInterval(‘change()‘, 50);
    }

    function ok() {
        clearInterval(timer);
    }

    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() {
        noDupNum();
        clearInterval(time);
        document.getElementById("start").disabled = false;
        document.getElementById("end").disabled = true;
        setValues();
    }

    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()" 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>
                        <td>
                            <input name="text40" type="text" id="40" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input name="text41" type="text" id="41" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="28" readonly/>
                        </td>
                        <td>
                            <input name="text42" type="text" id="42" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text43" type="text" id="43" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text44" type="text" id="44" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text45" type="text" id="45" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                    </tr>
                </table>
                <p>¶þµÈ½±£¨15Ãû£©</p>
                <table width="951" height="88" border="1">
                    <tr>
                        <td>
                            <input name="text21" type="text" id="21" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="28" readonly/>
                        </td>
                        <td>
                            <input name="text22" type="text" id="22" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text23" type="text" id="23" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text24" type="text" id="24" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text25" type="text" id="25" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input name="text26" type="text" id="26" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="28" readonly/>
                        </td>
                        <td>
                            <input name="text27" type="text" id="27" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text28" type="text" id="28" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text29" type="text" id="29" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text30" type="text" id="30" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input name="text31" type="text" id="31" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="28" readonly/>
                        </td>
                        <td>
                            <input name="text32" type="text" id="32" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text33" type="text" id="33" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text34" type="text" id="34" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text35" type="text" id="35" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                    </tr>
                </table>
                <p>ÈýµÈ½±£¨20Ãû£©</p>
                <table width="961" height="102" border="1">
                    <tr>
                        <td>
                            <input name="text1" type="text" id="1" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="28" readonly/>
                        </td>
                        <td>
                            <input name="text2" type="text" id="2" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text3" type="text" id="3" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text4" type="text" id="4" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text5" type="text" id="5" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input name="text6" type="text" id="6" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="28" readonly/>
                        </td>
                        <td>
                            <input name="text7" type="text" id="7" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text8" type="text" id="8" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text9" type="text" id="9" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text10" type="text" id="10" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input name="text11" type="text" id="11" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="28" readonly/>
                        </td>
                        <td>
                            <input name="text12" type="text" id="12" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text13" type="text" id="13" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text14" type="text" id="14" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text15" type="text" id="15" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input name="text16" type="text" id="16" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="28" readonly/>
                        </td>
                        <td>
                            <input name="text17" type="text" id="17" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text18" type="text" id="18" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text19" type="text" id="19" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                        <td>
                            <input name="text20" type="text" id="20" style="height:30px;width:190px;border:1px solid
red;font-size:25;" size="20" readonly/>
                        </td>
                    </tr>
                </table>
                <p> </p>
                <p> </p>
                <p> </p>
            </div>
        </div>
        <center>
</body>

</html>
时间: 2024-10-10 23:30:35

html 抽奖代码的相关文章

js手机号批量滚动抽奖代码实现

我们平时在看一些选秀节目或一些歌唱类比赛节目时经常会看到在现场的大屏幕上会有观众的手机号在滚动来选出谁是幸运观众或谁中了什么奖项,这些手机号都是现场观众或场外观众在给选手投票时产生的,当主持人一声开始令下,大屏幕上的手机号就会快速随机滚动,当主持人一声停令下,大屏幕上会随机出现几个停止滚动的手机号,这种手机号批量随机滚动的效果,就是我们今天要实现的效果.注意,在这个效果的实现当中最核心的就是随机和不重复. 下面,我就简单来介绍一下原理:1.随机,我们要写一个随机数,而且这个随机数不能重复,这个不

js简单抽奖代码

年底了各个公司都有抽奖活动,我也写了一个超级简单的代码来实现抽奖效果,这里没有华丽的Css3效果,但却有短小精悍的js代码.核心:js的Math对象和Array对象 code: 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>random</title> 6 <style>

轮盘抽奖代码

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=640,user-scalable=no,target-densitydpi = device-dpi " /> <style> div{ text-alig

抽奖代码实现

public class Demo { public static void main(String[] args) { // 有百分之一的几率能够中奖 for (int i = 0; i < 100; i++) { if (Math.random() > 0.99) { System.out.println("恭喜你中奖了"); } } } } 原文地址:https://www.cnblogs.com/LangKeZ/p/12148625.html

晒订单赢图灵图书,《第一行代码——Android》福利活动劲爆来袭!

我的著作<第一行代码--Android>已经预售几天了,这段时间也有不少朋友早早地就订购了这本书,感谢大家对我一如既往的支持,在离发货还有十几天的时候就预订了这本书. 为了特别感谢在预售期就这么支持我的朋友们,现在图灵公司大力支持下举办一个晒订单赢图灵图书的活动,欢迎已经订购和准备订购的朋友们积极参与进来.如果你还没有订购,只需在7月31号之前下单,就可以参与此活动,购买地址见左侧导航栏. 活动介绍 凡是预售期间(即7月31号之前)在当当.京东.亚马逊.互动其中之一(不包含淘宝)订购<第

抽奖算法

网上找的抽奖代码都不满意,自己动手丰衣足食,有需要的可以直接拿去用,不收版权费的. /// <summary> /// 抽奖 /// </summary> public class Prize { /// <summary> /// 奖品关键字 /// </summary> public string Key { get; set; } /// <summary> /// 权重/数量 /// </summary> public int

第六次作业-----抽奖系统

先奉上最简单的抽奖代码... package Choujiang; public class Choujiang { public static void main(String[]args){ int[]a = new int[3]; String [] person ={"张三","李四","王二","李逵","小明"}; for(int i=0;i<3;i++){ a[i]=(int)(Math

【PHP原生】抽奖算法

不同的奖品具有不同的中奖概率. /* * 奖项数组 * 奖品id,名称,v表示中奖概率 */ $proArr = array( array('id'=>1,'name'=>'特等奖','v'=>1), array('id'=>2,'name'=>'一等奖','v'=>5), array('id'=>3,'name'=>'二等奖','v'=>10), array('id'=>4,'name'=>'三等奖','v'=>12), array

前端+php实现概率抽奖

转前端之后,后台工程师大大跑路了只能兼任他的位置写点东西了 前端+后台抽奖代码网上一大堆,引用一位仁兄前面的代码(比较懒抱歉,后面数据处理,奖项判断是否抽完我将会标红,因为前面的代码网上太多了都能找到) 引用部分-start---------------------> 准备工作 首先要准备素材,抽奖的界面用到两张图片,圆盘图片和指针图片,实际应用中可以根据不同的需求制作不同的圆盘图片. 接着制作html页面,实例中我们在body中加入如下代码: <div class="demo&qu