国产99热在线露出_欧美日韩精品在线免费_在线观看无码av一区二区_欧美成人爽视频BBW_免费精品国偷自产在线91_国产无遮挡又黄又爽不要vip软件_五月天婷婷欧美日韩一区_亚洲熟妇无码播放av另类_秋霞影院午夜福利网_亚洲国产精品无码第一二区

行業(yè)分享 2019-03-19 網(wǎng)頁(yè) 代碼

js網(wǎng)頁(yè)計(jì)數(shù)器實(shí)現(xiàn)代碼

今天客戶(hù)網(wǎng)站上要加一個(gè)網(wǎng)頁(yè)訪(fǎng)問(wèn)計(jì)數(shù)器的功能,下面是計(jì)數(shù)器的代碼

<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("您是到訪(fǎng)的第" + visits + "位用戶(hù)!")
// -->
</script>

下一篇 網(wǎng)站ICP備案一般需要多長(zhǎng)時(shí)間?

最新案例 查看更多

查看