zoukankan      html  css  js  c++  java
  • 判断第一次加载

    <html>
    <head>
        <title>Hello World</title>
        <meta charset="utf-8">
        <script languang="javascript">
            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=unescape(document.cookie.substring(offset, end))
                    }
                }
                return returnvalue;
            }
            function loadPopup(){
                console.log(get_cookie("firstload"));
                if (get_cookie("firstload")===""){
                    alert("This is the first time you run this program!");
                    document.cookie="firstload=true"
                }
            }
        </script>
    </head>
    <body onload="loadPopup()">
    </body>
    </html> 

  • 相关阅读:
    旧键盘 (20)
    人口普查(20)
    打印沙漏(20)
    程序运行时间(15)
    反转链表 (25)
    科学计数法 (20)
    组个最小数 (20)
    python yield使用
    python如何优雅判断类型
    python中如何优雅使用import
  • 原文地址:https://www.cnblogs.com/lzugis/p/6539883.html
Copyright © 2011-2022 走看看