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>


  • 相关阅读:
    virtual 关键字
    innerhtml和innertext的用法以及区别
    CSS中overflow:hidden
    CSS中的repeat
    VC++6.0打开文件出错的解决办法
    HTML+CSS基础总结
    Guid算法
    SQL初级阶段笔记
    text-decoration
    IDEA 在同一目录创建多个项目
  • 原文地址:https://www.cnblogs.com/jalenFish/p/14099123.html
Copyright © 2011-2022 走看看