http://pan.baidu.com/s/1gdf1kDd最新可到jquery插件官网下载
我实现时找的所有资料http://pan.baidu.com/s/1mg0pKaG【多了点jquery.cookie的API】
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| <script type="text/javascript" src="jquery.cookie.js"></script> <script type="text/javascript"> $(function () { $("#username").add("#password").val("");
if ($.cookie("rmbUser") == "true") { $("#keepPwd").prop("checked", true); $("#username").val($.cookie("userName")); $("#password").val($.cookie("passWord")); }
function rmbPwd(){ if ($("#keepPwd").prop("checked") == true) { var userName = $("#username").val(); var passWord = $("#password").val(); $.cookie("rmbUser", "true", { expires: 7 }); $.cookie("userName", userName, { expires: 7 }); $.cookie("passWord", passWord, { expires: 7 }); } else { $.cookie("rmbUser", "false", { expires: -1 }); $.cookie("userName", '', { expires: -1 }); $.cookie("passWord", '', { expires: -1 }); } }
$("#keepPwd").click(function(){ rmbPwd(); }); </script>
|