[转]Jquery操作cookie
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <head runat="server">
3 <title></title>
4 <script src="jquery-1.3.2-vsdoc.js" type="text/javascript"></script>
5 <script src="jquery.cookie.js" type="text/javascript"></script>
6 <script type="text/javascript">
7 $(function() {
8 $("#setcookie").click(function() {
9 $.cookie("test", "chenxizhang");
10 });
11
12 $("#getcookie").click(function() {
13 alert($.cookie("test"));
14 });
15 });
16 </script>
17 </head>
18 <body>
19 <form id="form1" runat="server">
20 <input type="button" value="设置cookie" id="setcookie"/>
21 <input type="button" value="读取cookie" id="getcookie"/>
22 </form>
23 </body>
24 </html>