0

我使用jfontsize'来增加/减小我网站上字体的大小。有谁知道如何记住页面之间的设置以及用户何时返回网站?我一直在尝试创建一个 cookie,但我运气不佳!

这是我目前拥有的:

<script type="text/javascript" language="javascript">
    function createCookie("textsizestyle", textsize, 365) {
        if (days) {
            var date = new Date();
            date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
            var expires = "; expires=" + date.toGMTString();
        }
        else var expires = "";
        document.cookie = name + "=" + value + expires;
    }

    function readCookie(name) {
        var nameEQ = name + "=";
        var ca = document.cookie.split(';');

        for (var i = 0; i < ca.length; i++) {
            var c = ca[i];
            while (c.charAt(0) == ' ') 
                c = c.substring(1, c.length);

            if (c.indexOf(nameEQ) == 0) 
                return c.substring(nameEQ.length, c.length);
        }

        return null;
    }
</script>

有人介意给我一些指示吗?

谢谢!

4

0 回答 0