zoukankan      html  css  js  c++  java
  • js 首次进入弹窗

    今天有个需求,首次进入需要弹窗,然后就在网上找了下,虽然看了很多但是说的都不是我想要的,最后终于到了一个合适的。

    function get_cookie(Name) {
        var search = Name + "=";
        var returnvalue = "";
        if (document.cookie.length > 0) {
            offset = document.cookie.indexOf(search);
            if (offset != -1) {
                // if cookie exists
                offset += search.length;
                // set index of beginning of value
                end = document.cookie.indexOf(";", offset);
                // set index of end of cookie value
                if (end == -1)
                    end = document.cookie.length;
                returnvalue=decodeURI(document.cookie.substring(offset, end))
            }
        }
        return returnvalue;
    }
    setTimeout(function(){
        if (get_cookie("popped")==""){
            document.cookie="popped=yes";
            alert('弹窗');
        }
    },2000);
    

      

    (转载请注明花儿为何那样红博客)
  • 相关阅读:
    structInMemory
    合并字符串
    eggs
    1005. Spell It Right (20) -PAT
    60 人工智能
    50 计算机网络
    20数据结构
    40操作系统
    10 C/C++/python
    30汇编
  • 原文地址:https://www.cnblogs.com/chancy/p/6846674.html
Copyright © 2011-2022 走看看