在javascript中进行cookie的读写操作

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="jquery-1.3.2-vsdoc.js" type="text/javascript"></script>
    <script src="jquery.cookie.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function() {
            $("#setcookie").click(function() {
                $.cookie("test", "chenxizhang");
            });

            $("#getcookie").click(function() {
                alert($.cookie("test"));
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <input type="button" value="设置cookie"  id="setcookie"/>
    <input type="button" value="读取cookie"  id="getcookie"/>
    </form>
</body>
</html>

原文地址:https://www.cnblogs.com/chenxizhang/p/1596271.html