jquery 访问cookie
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<script src="jquery-1.7.1.min.js"></script>
<script src="jquery.cookie.js"></script>
<script>
$(function () {
$('#btnSet').click(function () {
var date = new Date();
$.cookie('time', date.toLocaleTimeString());
});
$('#btnGet').click(function () {
$('#txt').val($.cookie('time'));
});
});
</script>
</head>
<body>
<input type="button" name="name" value="set" id="btnSet" />
<input type="button" name="name" value="get" id="btnGet" />
<input type="text" name="name" value=" " id="txt"/>
</body>
</html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<script src="jquery-1.7.1.min.js"></script>
<script src="jquery.cookie.js"></script>
<script>
$(function () {
$('#btnSet').click(function () {
var date = new Date();
$.cookie('time', date.toLocaleTimeString());
});
$('#btnGet').click(function () {
$('#txt').val($.cookie('time'));
});
});
</script>
</head>
<body>
<input type="button" name="name" value="set" id="btnSet" />
<input type="button" name="name" value="get" id="btnGet" />
<input type="text" name="name" value=" " id="txt"/>
</body>
</html>