zoukankan      html  css  js  c++  java
  • 一天只弹出1次的公告代码

    <html>
    <head>
    <title>温馨提醒</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head>
    <body>
    <script>
    var alertmessage="你是猪,哈哈哈"
    var once_per_session=1
    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
          end = document.cookie.indexOf(";", offset);
          if (end == -1)
             end = document.cookie.length;
          returnvalue=unescape(document.cookie.substring(offset, end))
          }
       }
      return returnvalue;
    }

    function alertornot(){
    if (get_cookie('alerted')==''){
    loadalert()
    document.cookie="alerted=yes"
    }
    }

    function loadalert(){
    alert(alertmessage)
    }

    if (once_per_session==0)
    loadalert()
    else
    alertornot()
    </script>
    </body>
    </html>


  • 相关阅读:
    匿名函数
    Python基础练习题5
    for循环实现一个注册小案例
    Python基础练习题4
    Python集合
    Python基础练习题3
    Python 元组和字典
    Python PEP8规范与python之禅
    Python基础练习题2
    常见的排序之冒泡排序
  • 原文地址:https://www.cnblogs.com/jalenFish/p/14099123.html
Copyright © 2011-2022 走看看