<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><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 전환//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br><html xmlns="http://www.w3.org/1999/xhtml"> <br><머리> <br><제목></제목> <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(), { 만료: 7 }); //{ 만료일: 7 }的意思是让cookie保存7天 <br>}) <br>}) <br></script> <br></head> <br><본문> <br><input type="text" id="user" /> <br><input type="button" id="login" value="提交" /> <br></body> <br></html> <br> </div>