用户名: 密码: 验证码: 注册           网站地图 高级搜索 RSS订阅 收藏本站
山东十七地市站长联盟信息: 济南 青岛 淄博 枣庄 东营 烟台 潍坊 济宁 泰安 威海 日照 莱芜 临沂 德州 聊城 滨州 菏泽      
您的位置:主页>设计在线>网页设计>

记录来访者次数的特效

[ 来源: | 作者: | 更新日期:2008-4-30 23:41:38 | 评论 0 条 | 我要投稿 ]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 字串6
<title>记住每个来访者的次数</title>
<script language="JavaScript">
字串4

<!--
var caution = false 字串4
function setCookie(name, value, expires, path, domain, secure) {
    var curCookie = name + "=" + escape(value) +
字串5

        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +

字串4


        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "")

字串1


    if (!caution || (name + "=" + escape(value)).length <= 4000)
        document.cookie = curCookie
字串8

    else
        if (confirm("Cookie exceeds 4KB and will be cut!"))

字串5


            document.cookie = curCookie
} 字串4
function getCookie(name) {
    var prefix = name + "=" 字串3
    var cookieStartIndex = document.cookie.indexOf(prefix)
    if (cookieStartIndex == -1) 字串7
        return null
    var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)

字串4


    if (cookieEndIndex == -1)
        cookieEndIndex = document.cookie.length

字串2


    return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}
字串3

function deleteCookie(name, path, domain) {
    if (getCookie(name)) { 字串9
        document.cookie = name + "=" +
        ((path) ? "; path=" + path : "") + 字串1
        ((domain) ? "; domain=" + domain : "") +
        "; expires=Thu, 01-Jan-70 00:00:01 GMT" 字串5
    }
}

字串5


function fixDate(date) {
    var base = new Date(0) 字串6
    var skew = base.getTime()
    if (skew > 0)

字串5


        date.setTime(date.getTime() - skew)
} 字串3
var now = new Date()
fixDate(now) 字串3
now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000)
var visits = getCookie("counter") 字串1
if (!visits)
    visits = 1 字串2
else
    visits = parseInt(visits) + 1
字串4

setCookie("counter", visits, now)
document.write("欢迎您第 " + visits + " 次来到本站点")
字串6

// -->
</script>
字串9

</head>
<body> 字串3
  
<p></p> 字串6
<p></p>                          
  

字串6


</body>
</html>

Tags:特效 次数 来访 记录 var name domain path visits if
您的评论
用户名:新注册) 密码: 匿名评论 [所有评论]

·用户发表意见仅代表其个人意见,并且承担一切因发表内容引起的纠纷和责任
·本站管理人员有权在不通知用户的情况下删除不符合规定的评论信息或留做证据
·请客观的评价您所看到的资讯,提倡就事论事,杜绝漫骂和人身攻击等不文明行为