时间:2021-07-01 10:21:17 帮助过:2人阅读
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="Scripts/jquery-1.10.2.min.js" type="text/javascript"></script>
<script src="Scripts/jquery.cookie.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
if ($.cookie("username")) {
$("#user").val($.cookie("username"));
}
$("#login").click(function () {
$.cookie("username", $("#user").val(), { expires: 7 }); //{ expires: 7 }的意思是让cookie保存7天
})
})
</script>
</head>
<body>
<input type="text" id="user" />
<input type="button" id="login" value="提交" />
</body>
</html>