zoukankan      html  css  js  c++  java
  • 摇号系统总结

    当前动画直接到达末状态
    $(".num").each(function(index){ //判断是否处于动态 if($(this).is(":animated")){ //停止 $(this).stop(false,true).animate(); //当前动画直接到达末状态 } });

     获取数组中的随机数

    function numRand() {
        var num =Surplusnums[Math.floor(Math.random()*Surplusnums.length)];
    return num;
    }

    判断浏览器是否支持 localStorage

      function isLocalStorage() {
            var testKey = 'test',
                    storage = window.localStorage;
            try {
                storage.setItem(testKey, 'testValue');
                storage.removeItem(testKey);
                return true;
            } catch (error) {
                return false;
            }
        } 
    localStorage使用:
    //获取已经摇号的结果及剩余的
            Surplusnums = localStorage.getItem("Surplusnums").split(",");
            selectnums  = localStorage.getItem("selectnums").split(",");


    ------------------------
    //保存结果信息
             localStorage.setItem("Surplusnums", Surplusnums);
              localStorage.setItem("selectnums", selectnums);
        //从剩余的数字中删除抽中的数字
            for(var i=0;i<Surplusnums.length;i++)
            {
                if(Surplusnums[i]==iNum)
                {
                   Surplusnums.splice(i, 1); 
                   break;
                }
            }
            //将抽中的数字加入到已选
            selectnums.push(getdate()+"!"+iNum);
  • 相关阅读:
    WPF Caliburn 学习笔记(五)HelloCaliburn
    MSDN 教程短片 WPF 20(绑定3ObjectDataProvider)
    MSDN 教程短片 WPF 23(3D动画)
    比赛总结一
    HDU3686 Traffic Real Time Query System
    HDU3954 Level up
    EOJ382 Match Maker
    UESTC1565 Smart Typist
    HDU3578 Greedy Tino
    ZOJ1975 The Sierpinski Fractal
  • 原文地址:https://www.cnblogs.com/xiaozizi/p/6039448.html
Copyright © 2011-2022 走看看