1:进入cookie插件=>2:登录界面<input type=”checkbox” id=”autologin” /><label for=”autologin”>下次自动登录</label>:3:登录方法:如果登录成功的话//如果选择:记住密码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’));});
,带着感恩的心启程,学会爱,爱父母,爱自己,爱朋友,爱他人。