<!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="jquery/scritps/jquery-1.8.3.js" type="text/javascript"></script>
<script src="jquery/scritps/jquery.cookie.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('#btnSet').click(function () {
//点击按钮,设置cookie
var date = new Date();
//设置cookie,第一个参数是键,第二个参数是值
$.cookie('itcast', date.toLocaleString());
});
$('#btnGet').click(function () {
//读取cookie,参数是键,返回根据键找到的 值
$('#txtTime').val($.cookie('itcast'));
});
});
</script>
</head>
<body>
<input type="button" id="btnSet" name="name" value="设置 " />
<input type="button" id="btnGet" name="name" value="获取 " />
<input type="text" id="txtTime" />
</body>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="jquery/scritps/jquery-1.8.3.js" type="text/javascript"></script>
<script src="jquery/scritps/jquery.cookie.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('#btnSet').click(function () {
//点击按钮,设置cookie
var date = new Date();
//设置cookie,第一个参数是键,第二个参数是值
$.cookie('itcast', date.toLocaleString());
});
$('#btnGet').click(function () {
//读取cookie,参数是键,返回根据键找到的 值
$('#txtTime').val($.cookie('itcast'));
});
});
</script>
</head>
<body>
<input type="button" id="btnSet" name="name" value="设置 " />
<input type="button" id="btnGet" name="name" value="获取 " />
<input type="text" id="txtTime" />
</body>
</html>