在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>

posted @ 2009-11-04 22:43  陈希章  阅读(274)  评论(0编辑  收藏  举报