JQuery記住用戶名密碼實(shí)現(xiàn)下次自動(dòng)登錄功能
Jquery將用戶名密碼存儲(chǔ)到cookie中
需要導(dǎo)入jquery.js和jquery.cookie.js
<html> <head> <title>test cookie</title> <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script> <script src="Scripts/jquery.cookie.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function () { if ($.cookie("rmbUser") == "true") { $("#ck_rmbUser").attr("checked", true); $("#txt_username").val($.cookie("username")); $("#txt_password").val($.cookie("password")); } }); //記住用戶名密碼 function Save() { if ($("#ck_rmbUser").attr("checked")) { var str_username = $("#txt_username").val(); var str_password = $("#txt_password").val(); $.cookie("rmbUser", "true", { expires: 7 }); //存儲(chǔ)一個(gè)帶7天期限的cookie $.cookie("username", str_username, { expires: 7 }); $.cookie("password", str_password, { expires: 7 }); } else { $.cookie("rmbUser", "false", { expire: -1 }); $.cookie("username", "", { expires: -1 }); $.cookie("password", "", { expires: -1 }); } }; </script> </head> <body> <div> 用戶名:<input type="text" id="txt_username"/><br /> 密碼:<input type="text" id="txt_password"/><br /> <input type="checkbox" id="ck_rmbUser"/>記住用戶名和密碼<br /> <input type="submit" id="sub" value="登錄" onclick="Save()"/> </div> </body> </html>
- jQuery+Ajax用戶登錄功能的實(shí)現(xiàn)
- jquery 彈出登錄窗口實(shí)現(xiàn)代碼
- PHP+jQuery+Ajax實(shí)現(xiàn)用戶登錄與退出
- jquery ajax 登錄驗(yàn)證實(shí)現(xiàn)代碼
- 基于jquery ajax 用戶無(wú)刷新登錄方法詳解
- 基于Jquery+div+css實(shí)現(xiàn)彈出登錄窗口(代碼超簡(jiǎn)單)
- 使用Jquery打造最佳用戶體驗(yàn)的登錄頁(yè)面的實(shí)現(xiàn)代碼
- javascript和jquery實(shí)現(xiàn)用戶登錄驗(yàn)證
- jQuery實(shí)現(xiàn)彈出窗口中切換登錄與注冊(cè)表單
- jQuery實(shí)現(xiàn)簡(jiǎn)單登錄條件判斷
相關(guān)文章
jQuery對(duì)象和DOM對(duì)象的相互轉(zhuǎn)化實(shí)現(xiàn)代碼
jQuery對(duì)象就是通過(guò)jQuery包裝DOM對(duì)象后產(chǎn)生的對(duì)象。jQuery對(duì)象是jQuery獨(dú)有的,其可以使用jQuery里的方法,但是不能使用DOM的方法;例如$("#img").attr("src","test.jpg"); 這里的$("#img")就是jQuery對(duì)象;2010-03-03jQuery圖片預(yù)加載 等比縮放實(shí)現(xiàn)代碼
jQuery圖片預(yù)加載 等比縮放實(shí)現(xiàn)代碼,需要的朋友可以參考下。2011-10-10jquery-1.2.6得到焦點(diǎn)與失去焦點(diǎn)的寫(xiě)法
jquery-1.2.6得到焦點(diǎn)與失去焦點(diǎn)的實(shí)現(xiàn)方法。點(diǎn)擊“運(yùn)行”后,請(qǐng)刷新一次。2009-05-05jQuery實(shí)現(xiàn)顏色打字機(jī)的完整代碼
這篇文章主要介紹了jQuery實(shí)現(xiàn)顏色打字機(jī)的完整代碼,代碼簡(jiǎn)單易懂,非常不錯(cuò),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-03-03jQuery插件Flexslider實(shí)現(xiàn)圖片輪播、圖文結(jié)合滑動(dòng)切換效果
這篇文章主要介紹了jQuery插件Flexslider實(shí)現(xiàn)圖片輪播、圖文結(jié)合滑動(dòng)切換效果的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-07-07jQuery HTML獲取內(nèi)容和屬性操作實(shí)例分析
這篇文章主要介紹了jQuery HTML獲取內(nèi)容和屬性操作,結(jié)合實(shí)例形式分析了jQuery HTML獲取內(nèi)容和屬性相關(guān)函數(shù)用法與操作注意事項(xiàng),需要的朋友可以參考下2020-05-05jQuery 添加/移除CSS類(lèi)實(shí)現(xiàn)代碼
在網(wǎng)頁(yè)設(shè)計(jì)中,我們常常要使用Javascript來(lái)改變頁(yè)面元素的樣式。2010-02-02