• 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的……..
  • 相关阅读:
    修改MySQL数据文件的位置
    服务名无效。请键入 NET HELPMSG 2185 以获得更多的帮助。
    索引的讲解
    运行php程序时,浏览器跳出打开和保存提示框
    ora-4031错误
    MySQL_Oracle_事物的隔离级别
    GNU与Linux
    计算机网络_第一章
    Linux网卡高级命令
    Linux RAID简介
  • 原文地址:https://www.cnblogs.com/jasy/p/12885474.html
Copyright © 2020-2023  润新知