页面刷新就+1(计算页面的访问次数)

2017-07-20  本文已影响0人  blank的小粉er
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <script>
    //访问页面的次数
        if(localStorage.pagecount)
        {
            localStorage.pagecount = Number(localStorage.pagecount) + 1;
        }
        else
        {
            localStorage.pagecount = 1;
        }
        document.write(localStorage.pagecount);
    </script>
</body>
</html>
上一篇 下一篇

猜你喜欢

热点阅读