//Remember password function js combine jquery operation Cookie implementation remember Password and username!
varUsername = document.getElementById ("username");varPassword = document.getElementById ("Password");varDate=NewDate ();varexpiresdays=1000;//The expiration time. Date.settime (Date.gettime () +expiresdays*24*3600*1000); varstr_in;varStr_out = ""; varnum_in;varNum_out = "";//EncryptfunctionStr_to_num (val) {num_out= ""; //if (Form.input.value = = "") alert (e); //else {Str_in =Escape (Val); for(i = 0; i < str_in.length; i++) {Num_out+ = Str_in.charcodeat (i)-23; } //form.output.value = num_out; //form.input.value = ""; returnnum_out;}//decryptionfunctionNum_to_str (val) {str_out= ""; Num_out=Val; for(i = 0; i < num_out.length; i + = 2) {num_in= parseint (Num_out.substr (i,[2)) + 23; Num_in= unescape ('% ' + num_in.tostring (16)); Str_out+=num_in; } varSTR_OUT_JM =unescape (str_out); returnSTR_OUT_JM;} $(function(){ $(". Data_sub.sub_click"). Click (function(){ if(document.getElementById ("checkbox"). Checked) {Document.cookie= "A=" + str_to_num (username.value) + "; Expires= "+date.togmtstring (); Document.cookie= "b=" + str_to_num (password.value) + "; Expires= "+date.togmtstring (); }Else{ return; } }); varuser = GetCookie ("a"); varpass = GetCookie ("b"); if(Username.value = = "") {Username.value=num_to_str (user); } if(Password.value = = "") {Password.value=Num_to_str (pass); } });});functionGetCookie (name) {varStrcookie=Document.cookie; varArrcookie=strcookie.split (";"); for(vari=0;i<arrcookie.length;i++){ varArr=arrcookie[i].split ("="); if(Arr[0]==name)returnArr[1]; } return""; }
Remember password function js combined with jquery operation Cookie Implementation remember password and user name!