标签:
<script src="jquery.cookie.js" type="text/javascript"></script>
<input type="checkbox" id="autologin" /><label for="autologin">下次自动登录</label>
//如果选择:记住密码
var chk = $(‘#autologin‘)[0].checked;
if (chk) {
$.cookie(‘autologin‘, chk, {expires: 7});
$.cookie(‘username‘, $(‘#username‘).val(), {expires: 7});
$.cookie(‘password‘, $(‘#password‘).val(), {expires: 7});
}else {
//如果没有选择;记住密码
$.cookie(‘autologin‘, chk);
$.cookie(‘username‘, $(‘#username‘).val());
$.cookie(‘password‘, $(‘#password‘).val());
}
4:登录界面初始化
$(document).ready(function() {
$(‘#autologin‘)[0].checked = $.cookie(‘autologin‘);
$(‘#username‘).val($.cookie(‘username‘));
$(‘#password‘).val($.cookie(‘password‘));
});
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:
原文地址:http://blog.csdn.net/u013628152/article/details/46722415