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);
  • 相关阅读:
    Count and Say
    Valid Sudoku
    Find First and Last Position of Element in Sorted Array
    Search in Rotated Sorted Array
    Longest Valid Parentheses
    web前端中文教程库
    三代基因组拼接软件--Falcon篇
    使用ThreadPoolExecutor并行执行独立的单线程任务
    python中的计时器:timeit
    Python教程
  • 原文地址:https://www.cnblogs.com/xiaozizi/p/6039448.html
Copyright © 2011-2022 走看看