destoon實現(xiàn)底部添加你是第幾位訪問者的方法
經(jīng)常會看到一些網(wǎng)站有類似“您是第位訪客”字樣的計數(shù)統(tǒng)計,這里我們來實現(xiàn)把這個統(tǒng)計功能添加到destoon的底部,顯示“你是第幾問訪問者”的效果。此處的計數(shù)器與網(wǎng)站流量統(tǒng)計有區(qū)別,記錄的是刷新次數(shù),并不是真實記錄訪問者的IP,對于需要真正進(jìn)行統(tǒng)計的朋友可以進(jìn)一步完善代碼以滿足自身需求。
下面就來說一下具體的實現(xiàn)方法:
打開底部footer.htm的文件,找到<a href="{$MODULE[1][linkurl]}" rel="external nofollow" >返回首頁</a>,在后面加上這段代碼:
<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 (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>
- destoon調(diào)用discuz論壇中帶圖片帖子的實現(xiàn)方法
- destoon調(diào)用企業(yè)會員公司形象圖片的實現(xiàn)方法
- destoon實現(xiàn)調(diào)用當(dāng)前欄目分類及子分類和三級分類的方法
- destoon實現(xiàn)VIP排名一直在前面排序的方法
- Destoon實現(xiàn)多表查詢示例
- destoon首頁調(diào)用求購供應(yīng)信息的地區(qū)名稱的方法
- destoon實現(xiàn)調(diào)用熱門關(guān)鍵字的方法
- destoon實現(xiàn)資訊信息前面調(diào)用它所屬分類的方法
- destoon實現(xiàn)首頁顯示供應(yīng)、企業(yè)、資訊條數(shù)的方法
- destoon實現(xiàn)公司新聞詳細(xì)頁添加評論功能的方法
- destoon數(shù)據(jù)庫表說明匯總
- destoon切換城市后實現(xiàn)logo旁邊顯示地區(qū)名稱的方法
相關(guān)文章
在Laravel5.6中使用Swoole的協(xié)程數(shù)據(jù)庫查詢
這篇文章主要介紹了在Laravel5.6中使用Swoole的協(xié)程數(shù)據(jù)庫查詢,詳細(xì)的介紹了什么是Swoole,以及Laravel5.6中使用Swoole,非常具有實用價值,需要的朋友可以參考下2018-06-06
Thinkphp的volist標(biāo)簽嵌套循環(huán)使用教程
這篇文章主要介紹了Thinkphp實現(xiàn)volist標(biāo)簽嵌套循環(huán)的方法,需要的朋友可以參考下2014-07-07
ThinkPHP整合datatables實現(xiàn)服務(wù)端分頁的示例代碼
下面小編就為大家分享一篇ThinkPHP整合datatables實現(xiàn)服務(wù)端分頁的示例代碼,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-02-02

