<div class="codetitle"> <span><a style="CURSOR: pointer" data="50938" class="copybut" id="copybut50938" onclick="doCopy('code50938')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code50938"> <br> <br> <br> <br><title></title> <br><script src="Scripts/jquery-1.10.2.min.js" type="text/javascript"></script> <br><script src="Scripts/jquery.cookie.js" type="text/javascript"></script> <br><script type="text/javascript"> <BR>$(function () { <BR>if ($.cookie("username")) { <BR>$("#user").val($.cookie("username")); <br><br>} <br><br>$("#login").click(function () { <BR>$.cookie("username", $("#user").val(), { expires: 7 }); //{ expires: 7 }的意思是让cookie保存7天 <BR>}) <BR>}) <BR></script> <br> <br> <br><input type="text" id="user"> <br><input type="button" id="login" value="提交"> <br> <br> <br> </div>