• js 显示网站当前访客是几位访客


    <SCRIPT language=JavaScript>
    
    <!--
    
    var caution = false
    
    function setCookie(name, value, expires, path, domain, secure) {
    
    var curCookie = name + "=" + escape(value) +
    
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    
    ((path) ? "; path=" + path : "") +
    
    ((domain) ? "; domain=" + domain : "") +
    
    ((secure) ? "; secure" : "")
    
    if (!caution || (name + "=" + escape(value)).length <= 4000)
    
    document.cookie = curCookie
    
    else
    
    if (confirm("Cookie exceeds 4KB and will be cut!"))
    
    document.cookie = curCookie
    
    }
    
    function getCookie(name) {
    
    var prefix = name + "="
    
    var cookieStartIndex = document.cookie.indexOf(prefix)
    
    if (cookieStartIndex == -1)
    
    return null
    
    var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
    
    if (cookieEndIndex == -1)
    
    cookieEndIndex = document.cookie.length
    
    return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
    
    }
    
    function deleteCookie(name, path, domain) {
    
    if (getCookie(name)) {
    
    document.cookie = name + "=" +
    
    ((path) ? "; path=" + path : "") +
    
    ((domain) ? "; domain=" + domain : "") +
    
    "; expires=Thu, 01-Jan-70 00:00:01 GMT"
    
    }
    
    }
    
    function fixDate(date) {
    
    var base = new Date(0)
    
    var skew = base.getTime()
    
    if (skew > 0)
    
    date.setTime(date.getTime() - skew)
    
    }
    
    var now = new Date()
    
    fixDate(now)
    
    now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000)
    
    var visits = getCookie("counter")
    
    if (!visits)
    
    visits = 1
    
    else
    
    visits = parseInt(visits) + 1
    
    setCookie("counter", visits, now)
    
    document.write("欢迎光临本站,您是第" + visits + "位访问者!")
    
    // -->
    
    </SCRIPT>

    js 显示网站当前访客是几位访客 - 百度文库 https://wenku.baidu.com/view/4fc24563f90f76c661371aad.html

    奶奶问孙子:4+1等于几 孙子说:等于6-1。 奶奶说:你明明知道答案,为什么不说? 孙子说:年轻人不讲5的……..
  • 相关阅读:
    如果你想开发一个应用(1-17)
    如果你想开发一个应用(1-16)
    如果你想开发一个应用(1-15)
    0079 Ehcache 3.x应用入门及通过JCache与Spring整合
    0078 Java与MySQL时间戳传递/存储/协调问题--userLegacyDatetimeCode--userTimezone--serverTimezone
    0077 web.xml中配置Spring MVC时,Servlet-name上报Servlet should have a mapping的错误
    0076 判断回文串
    0075 字符串的反转
    0074 几道面试题
    0073 javacTask: 源发行版 1.8 需要目标发行版 1.8
  • 原文地址:https://www.cnblogs.com/jasy/p/12885474.html
Copyright © 2020-2023  润新知