日期:2014-05-16  浏览次数:20717 次

读取到的cookie值是null,求救!
<html>
<head>
<script src="jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="cookies.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$(".a").click(function(){
$.cookie('a1',$(".a").text());
alert($.cookie('a1'));
});
});
</script>
</head>
<body>
<p class="a" style="cursor:pointer;">123</p>
</body>
</html>

------解决方案--------------------
没问题。
<html>
<head>
<script src="../../../lib/jquery/jquery-1.7.2.js" type="text/javascript"></script>
<script src="../../jquery-cookie-master/jquery.cookie.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$(".a").click(function(){
$.cookie('a1',$(".a").text());
alert($.cookie('a1'));
});
});
</script>
</head>
<body>
<p class="a" style="cursor:pointer;">123</p>
</body>
</html>