<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 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <BR><html xmlns="http://www.w3.org/1999/xhtml"> <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("ユーザー名")) { <br>$("#user").val($.cookie("ユーザー名")); <br> <br>} <br><br>$("#login").click(function () { <br>$.cookie("username", $("#user").val(), { 有効期限: 7 }); //{ 有効期限: 7 } の意思はクッキー保存 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>