(078)jquery_插件_cookie

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
  <head>
    <title>plug_cookie.html</title>
    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
    <script type="text/javascript" src="../js/jquery/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="../js/jquery_cookie/jquery.cookie.js"></script>
    <script type="text/javascript">
        $(function(){
            if($.cookie("email")) {
                $("#email").val($.cookie("email"));
            }
            $("#chksave").bind("click",function(){
                if($("#chksave").is(":checked")) { 
                    $.cookie("email",$("#email").val(),{path:"/",expires:7});
                }
                else {
                    $.cookie("email",null,{path:"/",expires:7});
                }
            });
        });
    </script>
  </head>
  
  <body>
        <div id="divtest">
            <div class="title">
                <span class="fl">cookie插件</span> 
                <span class="fr">
                    <input id="btnSet" type="button" value="设置" />
                </span>
            </div>
            <div class="content">
                <span class="fl">邮箱:</span><br />
                <input id="email" name="email" type="text" /><br />
                <input id="chksave" type="checkbox" />是否保存邮箱
            </div>
        </div>
  </body>
</html>

 

posted @ 2015-01-07 14:36  雪中飞雁  阅读(65)  评论(0)    收藏  举报